JavaScript unit test tools for TDD

2018-12-31 14:16发布

I've looked into and considered many JavaScript unit tests and testing tools, but have been unable to find a suitable option to remain fully TDD compliant. So, is there a JavaScript unit test tool that is fully TDD compliant?

13条回答
闭嘴吧你
2楼-- · 2018-12-31 14:31

We are now using Qunit with Pavlov and JSTestDriver all together. This approach works well for us.

QUnit

Pavlov, source

jsTestDriver, source

查看更多
人间绝色
3楼-- · 2018-12-31 14:37

Chutzpah - A JavaScript Test Runner

I created an open source project called Chutzpah which is a test runner for JavaScript unit tests. Chutzpah enables you to run JavaScript unit tests from the command line and from inside of Visual Studio. It also supports running in the TeamCity continuous integration server.

查看更多
与风俱净
4楼-- · 2018-12-31 14:41

MochiKit has a testing framework called SimpleTest that seems to have caught on. Here's a blog post from the original author.

查看更多
十年一品温如言
5楼-- · 2018-12-31 14:42

Take a look at the Dojo Object Harness (DOH) unit test framework which is pretty much framework independent harness for JavaScript unit testing and doesn't have any Dojo dependencies. There is a very good description of it at Unit testing Web 2.0 applications using the Dojo Objective Harness.

If you want to automate the UI testing (a sore point of many developers) — check out doh.robot (temporary down. update: other link http://dojotoolkit.org/reference-guide/util/dohrobot.html ) and dijit.robotx (temporary down). The latter is designed for an acceptance testing. Update:

Referenced articles explain how to use them, how to emulate a user interacting with your UI using mouse and/or keyboard, and how to record a testing session, so you can "play" it later automatically.

查看更多
人气声优
6楼-- · 2018-12-31 14:42

BusterJS

There is also BusterJS from Christian Johansen, the author of Test Driven Javascript Development and the Sinon framework. From the site:

Buster.JS is a new JavaScript testing framework. It does browser testing by automating test runs in actual browsers (think JsTestDriver), as well as Node.js testing.

查看更多
只靠听说
7楼-- · 2018-12-31 14:42

YUI has a testing framework as well. This video from Yahoo! Theater is a nice introduction, although there are a lot of basics about TDD up front.

This framework is generic and can be run against any JavaScript or JS library.

查看更多
登录 后发表回答