JavaScript unit test tools for TDD -
i've looked , considered many javascript unit tests , testing tools, have been unable find suitable option remain tdd compliant. so, there javascript unit test tool tdd compliant?
karma or protractor
karma javascript test-runner built node.js , meant unit testing.
the protractor end-to-end testing , uses selenium web driver drive tests.
both have been made angular team. can use assertion-library want either.
screencast: karma getting started
related:
pros:
- uses node.js, compatible win/os x/linux
- run tests browser or headless phantomjs
- run on multiple clients @ once
- option launch, capture, , automatically shutdown browsers
- option run server/clients on development computer or separately
- run tests command line (can integrated ant/maven)
- write tests xunit or bdd style
- supports multiple javascript test frameworks
- auto-run tests on save
- proxies requests cross-domain
- possible customize:
- extend wrap other test-frameworks (jasmine, mocha, qunit built-in)
- your own assertions/refutes
- reporters
- browser launchers
- plugin webstorm
- supported netbeans ide
cons:
- does not support nodejs (i.e. backend) testing
- no plugin eclipse (yet)
- no history of previous test results
buster.js
a javascript test-runner built node.js. modular , flexible. comes own assertion library, can add own if like. assertions library decoupled, can use other test-runners. instead of using assert(!...)
or expect(...).not...
, uses refute(...)
nice twist imho.
a browser javascript testing toolkit. browser testing browser automation (think jstestdriver), qunit style static html page testing, testing in headless browsers (phantomjs, jsdom, ...), , more. take @ the overview!
a node.js testing toolkit. same test case library, assertion library, etc. great hybrid browser , node.js code. write test case buster.js , run both in node.js , in real browser.
screencast: buster.js getting started (2:45)
pros:
- uses node.js, compatible win/os x/linux
- run tests browser or headless phantomjs (soon)
- run on multiple clients @ once
- supports nodejs testing
- don't need run server/clients on development computer (no need ie)
- run tests command line (can integrated ant/maven)
- write tests xunit or bdd style
- supports multiple javascript test frameworks
- defer tests instead of commenting them out
- sinonjs built in
- auto-run tests on save
- proxies requests cross-domain
- possible customize:
- extend wrap other test-frameworks (jstestdriver built in)
- your own assertions/refutes
- reporters (xunit xml, traditional dots, specification, tap, teamcity , more built in)
- customize/replace html used run browser-tests
- textmate , emacs integration
cons:
- stil in beta can buggy
- no plugin eclipse/intellij (yet)
- doesn't group results os/browser/version testswarm *. does, however, print out browser name , version in test results.
- no history of previous test results testswarm *
- doesn't work on windows as of may 2014
* testswarm continuous integration server, while need separate ci server buster.js. does, however, output xunit xml reports, should easy integrate hudson, bamboo or other ci servers.
testswarm
https://github.com/jquery/testswarm
testswarm officially no longer under active development stated on github webpage. recommend karma, browserstack-runner, or intern.
browserswarm
the website www.browserswarm.com
dead , there no recent search results browserswarm. appears have died.
browserswarm project appendto, sauce labs , internet explorer team. hosted forked version of testswarm.
in addition advantages testswarm, browserswarm has browsers connected swarm , ready test code, therefore not requiring add clients or maintaining installations of browsers. time saved hassle of setting , configuring testswarm.
jasmine
this client-side test-runner might interest developers familiar ruby or ruby on rails. syntax based on rspec that's used testing in rails projects.
jasmine behavior-driven development framework testing javascript code. not depend on other javascript frameworks. not require dom.
if have experience test-runner, please contribute more info :)
project home: http://jasmine.github.io/
qunit
qunit focuses on testing javascript in browser while providing convenience developer possible. blurb site:
qunit powerful, easy-to-use javascript unit test suite. it's used jquery, jquery ui , jquery mobile projects , capable of testing generic javascript code
qunit shares history testswarm (above):
qunit developed john resig part of jquery. in 2008 got own home, name , api documentation, allowing others use unit testing well. @ time still depended on jquery. rewrite in 2009 fixed that, qunit runs standalone. qunit's assertion methods follow commonjs unit testing specification, degree influenced qunit.
project home: http://qunitjs.com/
sinon
another great tool sinon.js christian johansen, author of test-driven javascript development. best described himself:
standalone test spies, stubs , mocks javascript. no dependencies works unit testing framework.
intern
the intern web site provides direct feature comparison other testing frameworks on list. offers more features out of box other javascript-based testing system.
mocha.js
i'm totally unqualified comment on mocha.js's features, strengths, , weaknesses, recommended me trust in js community.
list of features, reported web site:
- browser support
- simple async support, including promises
- test coverage reporting
- string diff support
- javascript api running tests
- proper exit status ci support etc
- auto-detects , disables coloring non-ttys
- maps uncaught exceptions correct test case
- async test timeout support
- test-specific timeouts
- growl notification support
- reports test durations
- highlights slow tests
- file watcher support
- global variable leak detection
- optionally run tests match regexp
- auto-exit prevent "hanging" active loop
- easily meta-generate suites & test-cases
- mocha.opts file support
- clickable suite titles filter test execution
- node debugger support
- detects multiple calls done()
- use assertion library want
- extensible reporting, bundled 9+ reporters
- extensible test dsls or "interfaces"
- before, after, before each, after each hook
- arbitrary transpiler support (coffee-script etc)
- textmate bundle
yolpo
yolpo tool visualize execution of javascript. javascript api developers encouraged write use cases show , tell api. such use cases forms basis of regression tests.
ava
futuristic test runner built-in support es2015. though javascript single-threaded, io in node.js can happen in parallel due async nature. ava takes advantage of , runs tests concurrently, beneficial io heavy tests. in addition, test files run in parallel separate processes, giving better performance , isolated environment each test file.
- minimal , fast
- simple test syntax
- runs tests concurrently
- enforces writing atomic tests
- no implicit globals
- isolated environment each test file
- write tests in es2015
- promise support
- generator function support
- async function support
- observable support
- enhanced asserts
- optional tap output
- clean stack traces
Comments
Post a Comment