Once this remote server is configured, it’s really just a matter of setting up the yaml configuration file (jsTestDriver.conf here):
server: http://server-name:9876 load: - jasmine/jasmine.js - JasmineAdapter.js - fileundertest.js - fileundertest.specs.js
And executing something like the following script:
if not exist Out\JsTestDriverResults mkdir Out\JsTestDriverResults java -jar JsTestDriver-1.3.2.jar --config jsTestDriver.conf --testOutput Out\JsTestDriverResults --reset --verbose --tests all
In the example above, fileundertest.js contains the code we want to test and fileundertest.specs.js contains the Jasmine tests. Obviously you can add as many files as required and even include dependencies such as jQuery, though that starts to get a little ropey. There is a Jasmine plugin that supports jQuery and DOM manipulation for the interested reader.
The results are output to Out\JsTestDriverResults in an JUnit compatible format which can be read by TeamCity when this script is executed as part of a build. These results then show up in TeamCity and any failing tests will be easy to spot.