Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Sean Killeen
Sean Killeen

Posted on • Originally published atseankilleen.com on

     

How to: Show Jasmine test results in TeamCity

A colleague wanted to surface their jasmine tests in a TeamCity build system. Wanted to document the steps I used to help them solve their problem.

Setting up the Jasmine Output

  • Add thejasmine-reporters package:npm -i jasmine-reporters --save-dev
  • Add anindex.js to set up the tests if you haven’t already:
varJasmine=require('jasmine');varreporters=require('jasmine-reporters');varjasmine=newJasmine();// Load configuration from a file or from an object. jasmine.loadConfig({"spec_dir":"spec","spec_files":["**/*\[sS]pec.js"],"helpers":["helpers/**/*.js"],"stopSpecOnExpectationFailure":false,"random":true});jasmine.execute();
Enter fullscreen modeExit fullscreen mode
  • Prior to executing the steps, add the TeamCity reporter:
varteamCityReporter=newreporters.TeamCityReporter();jasmine.configureDefaultReporter(teamCityReporter);
Enter fullscreen modeExit fullscreen mode
  • Update the “test” or “tests” command in yourpackage.json:
"tests":"node .path/to/specs/index.js"
Enter fullscreen modeExit fullscreen mode
  • Prior to executing, add an additional NUnit XML Reporter:
varnunitXmlReporter=newreporters.NUnitXmlReporter();jasmine.addReporter(nunitXmlReporter);
Enter fullscreen modeExit fullscreen mode

Updating TeamCity

  • Open the build in question
  • From the Menu, add a build feature:

TeamCity build menu showing the option to add a build feature

  • Select the “XML Report Processing” feature, choose an NUnit-style report, and point it tonunitresults.xml (the default location for the jasmine NUnit output):

XML report processing options

  • Double-check the saved feature:

The added build feature

The Results

We see our tests listed in the build list:

Tests in the build list

And we see the test output in the overview tab:

Tests in the overview page of the build

And we see the a tests tab with the output of each individual test:

Tests in the build's tests tab

Hope this helps! Happy testing!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

A mind at work. Microsoft MVP && Passionate .NET dev lead && VP, Innovation and Products at SCT Software. Opinions here are mine. Trying to be all the human I can be with the time I have.
  • Location
    Arlington, VA
  • Education
    Muhlenberg College
  • Pronouns
    he/him
  • Work
    VP, Innovation and Products at SCT Software
  • Joined

More fromSean Killeen

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp