One caveat: I am not wanting to test cross-browser functionality. Therefore, I don’t need or want a browser or the associated slowness and the brittleness of cross-process orchestration. (Note: I have tried to stabilise these types of tests using NUnit and MSTest runners invoking selenium and/or watin – it gets unstable quickly and there is too much wiring up.)
So this approach is simple and blindly fast thanks to Andrew McKenzie’s jasmine-node-dom which is an extension of jasmine-dom. He wrote his for linux and his example is with Jenkins so I have forked a version for windows which has a node.exe binary which is available form node.js.
Anyway, this blog covers the powershell script to invoke the
jasmine-node-dom and publish it to
Here’s the script:
build.ps1 (or directly in TeamCity)
An explanation if it isn’t obvious. First let’s start with files that are needed. I have the windows node-jasmine-dom installed in its own directory. I then call
jasmine-dom. That should just work all out-of-the-box. I then tell it where the manifest is that knows about the tests (
tests.yaml – see below for example) and then I give it the results file.
jasmine-node-dom is great because it reads the
SpecRunner.html and reconstructs the
DOM enough that the tests are valid.
Finally, I tell teamcity to read the results out of
junit. This is very easy and I recommend that you find out what else you need to do.
--- test_one: name: Example test one runner: ./tests/SpecRunner.html
yaml file points to the
* All my jasmine tests are invoked from their own
SpecRunner.html file by convention
* I will write a script that will automatically generate the
* I always put all my powershell scripts into
psake scripts (then they can be run by the dev or the build machine)
* my code isn’t quite filed as above
# download jasmine-node-dom and install in
# add new
Task to build scripts (I use
# add a new
test.yaml manifest (or build one each time)
# Add new
jasmine tests via
# Ensure that the build script is run via a build step in a configuration from
# Now you can inspect the Tests in TeamCity