Is it possible to execute my QUnit (javascript) unit tests from Jenkins? My build script is Apache Ant. Would Jenkins execute this as a separate Build Step, or would I need
Qunit itself now maintains a phantomjs runner:
https://github.com/jquery/qunit/tree/master/addons/phantomjs
So assuming you've already installed phantomjs, grab runner.js from the link above (or get it using bower/whatever js package manager), put it somewhere jenkins can find it, and then use:
phantomjs path/to/runner.js path/to/your/qunit_tests.html
It gives minimal output like this:
$ phantomjs superlists/static/tests/runner.js accounts/static/tests/tests.html
Took 29ms to run 11 tests. 11 passed, 0 failed.
Or like this if it fails:
$ phantomjs superlists/static/tests/runner.js accounts/static/tests/tests.html
Test failed: sinon tests of navigator.id.watch: watch sees current user
Failed assertion: check user, expected: current user, but was: baz
at file:///home/harry/superlists/superlists/static/tests/qunit.js:556
at file:///home/harry/superlists/accounts/static/tests/tests.html:69
at file:///home/harry/superlists/superlists/static/tests/qunit.js:203
at file:///home/harry/superlists/superlists/static/tests/qunit.js:361
at process (file:///home/superlists/superlists/static/tests/qunit.js:1453)
at file:///home/harry/superlists/superlists/static/tests/qunit.js:479
Took 29ms to run 11 tests. 10 passed, 1 failed.
No junit-xml integration, but at least it returns an error code if it fails, so it'll fail the build in jenkins...
$ echo $?
1