Continuous JavaScript Testing with Karma Test Runner and TeamCity


In my recent blog post I explained how you can set up Karma test runner and install Jasmine in Visual Studio so you can unit test your JavaScript code. Once you got your test runner up and running locally, you would like to have continuous testing of your JavaScript code. What that means is that you want to have the test runner running on your build server as well, such that each time you check-in/commit your code, the build server will automatically start Karma and check your JavaScript.

TeamCity is a popular and widely used continuous integration solution by JetBrains, and it's quite easy to configure Karma with it. After you have installed Karma (by following my guide) on your build server, all you need to do is add a build step in TeamCity to start up the Karma test runner. You do this by adding the following command:

karma start --reporters teamcity --single-run

In the "Command executable" field in the TeamCity build step:

Picture1

That's pretty much it, let me know how that works out for you!