How to use Chutzpah with Visual Studio and Build?

If you want to do some JavaScript Unit testing your most probably going to use things like Jasmine, Qunit or Mocha, which are all great things, but how do you run them? This was a challenge I came upon with Visual Studio and how to get it running like a normal NUnit test.

First of all if you don’t know what Chutzpah is, it’s an Open Source Test Runner for JavaScript unit testing frameworks. It currently works with Jasmine, Qunit or Mocha, using the PhantomJS headless browser for testing. You can find out more information on these subjects with the links below:

Visual Studio Setup

To get Chutzpah set up in Visual Studio could not be easier. You simply need to install the Nuget Package from the manager. There are multiple method to do this, but the one I use is this.

  1. Open Visual Studio (version 2013 is used in the graphics)
  2. Click on ‘Tools’ from the top menu
  3. Click on ‘NuGet Package Manager’ then ‘Manage NuGet Packages for Solution…’
  4. Once the manager window pops up, search for ‘chutzpah’
  5. The results should show ‘Chutzpah – A JavaScript Test Runner’
  6. Install this NuGet package.


You now have it installed and you should see the unit testing icons next to your tests. For example, I use Qunit and it looks like this.



You will also notice if you are using Qunit that I have the ‘setup’ property in my module. This is because Chutzpah is running Qunit 1.23.1, not the latest 2.x. Therefore I would check what version testing framework you are using and if it is supported. You might want to use a different test runner or downgrade your framework.

Building with Team Foundation Server

Now I’m not going to go through how to use the TFS build definitions as this is a whole huge subject itself. However I would like to show how I got Chutzpah running on build as when researching I found only snippets scattered.

The method to do this is to run it via the command line, so I know most peoples ‘Build process templates’ will be different, but this is mine. In the build process template, I have a ‘Post-test script path’ and the arguments inputs. In these I put the commands.


As you will see I have a destination to the console exe application for Chutzpah. This is downloaded with the NuGet package and so should be in the same location for everyone. For copy and pasting people here is the destination:


As well as other parameters, the exe takes the directory location of where the tests are held. As the build would run from the root of the project, I have done the same. This is why the exe directory starts from packages and the arguments would also start from there. If you have one script you might put the file name at the end as well, but if you want to run all tests in a directory then only go as deep as you need.

You can test the running of this by opening the project directory in command line and running the same command. Quick-tip to get to the directory faster is to open it in File Explorer, then type ‘cmd’ in the address bar and click enter as below:


Once open you can run the command like this:

\packages\Chutzpah.4.3.4\tools\chutzpah.console.exe project\JsUnitTest\

You should then get the below:




Published by Chris Pateman - PR Coder

A Digital Technical Lead, constantly learning and sharing the knowledge journey.

Leave a message please

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: