对单元测试的Node.js模块 [英] Node.js modules for unit-testing

查看:103
本文介绍了对单元测试的Node.js模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个Web应用程序,它使用的jQuery AJAX 和UI。现在,我想单元测试添加到它。我想单元测试,以在一个进程中运行,而无需启动浏览器和独立的Web服务器,我希望这是可行的的node.js 及以下节点模块:

Suppose I have a web application, which uses jquery for ajax and UI. Now I would like to add unit-tests to it. I would like the unit-tests to run in a single process without launching browsers and separate web servers and I hope it is doable with the node.js and the following node modules:

  • buster.js
  • 的jQuery 节点模块
  • jsdom 节点模块
  • buster.js
  • jquery node module
  • jsdom node module

我缺少的东西?有没有这样的单元测试任何实际的例子?

Am I missing something? Is there any example of such unit-tests?

推荐答案

好了,你可以写你的测试例程断言,但我想用推荐单位-testing框架 - 更确切地说, nodeunit 。有一个整洁的文章描述如何使用这个模块来简化单元测试。

Well, you can write your test routines with assert, but I'd like to recommend using unit-testing frameworks - more specifically, nodeunit. There's a neat article describing how to use this module to simplify unit testing.

和我可以说实际上有一堆的线程这里(啊哈......)同样的问题 - 例如,的这个,有很多选择。 )

And may I say there's actually a bunch of threads here with (ahem...) the same question - for example, this one, with plenty of choices. )

这篇关于对单元测试的Node.js模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆