Karma Test Results with TFS Build

TLDR;

1. Setup the Karma Trx Reporter.
2. Add Publish Results Build Step using  ../TestResults/**/karma-test-results.trx as the path.
3. If remote Vm for Jasmine tests, copy the .trx file to the Results directory.

Our team has been using JasmineJs for unit testing our client side JavaScript code. We now have over 3,000 tests! In order to run these tests on multiple browsers we useKarma, the "Spectacular Test Runner for JavaScript" created by people from Google to run all our tests on multiple browsers. We are also using Microsoft's TFS Build (which is leaps and bounds improved over the old XAML build system) to run our tests in Gated Check ins, create build artifacts (dlls, installers, Azure packages), deploy to test environments and all number of fun things.

The default output results in the build from Karma has not been very helpful, just saying 1 of 1 passed or 0 of 1. We'd then have to open up a .trx file and look through the output to find which test failed.

See the rest of the article at Gooroo.

This article is part of the GWB Archives. Original Author: Aligned

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.