How to run Jasmine tests in TeamCity

We have been writing specifications for our JavaScript business logic using Jasmine. We're able to run our test suite within a browser, but how would we integrate this within TeamCity? Preferrably we do not want to use NodeJS, rather something as simple as possible.

Answers


I have created a modified version of run-jasmine.js that is found in the PhantomJS sources (original version is here. This version can be used within TeamCity (it will automatically detect that it is running in TeamCity). This updated version is using TeamCity service messages which allows for a nice integration.

You will need PhantomJS. You'll also need one of the following:

Add a build step in your TeamCity build configuration that can run this step:

phantomjs.exe run-jasmine.js index.html

index.html is your Jasmine runner page. If the build agents do not include PhantomJS, you can commit it to your repository along with your sources (this is what we do).

The result will look like this:

Test details:

The above is from a Tasks sample ASP.NET MVC project with this setup. It can be run in TeamCity using a Visual Studio (sln) build step. It will also run the tests within Visual Studio, as a pre-build step.


Need Your Help

Disable Location Bar of Browsers in Pop-up Windows

javascript html

I have the following HTML with Javascript:

How to upload a file through jQuery?

c# jquery asp.net-mvc

I am wondering how would I do this with like jQuery ajax. Right now I have a jQuery ui dialog box popup and it has an html input file on it.