Collect Test Coverage Data with your Local VSTS Build Server

Using a local build server with Visual Studio Team Services (VSTS) is not that complicated. The build agent and a community edition of Visual Studio is all you need to get started. However, there is a little catch with this setup: You don’t get test coverage for your unit tests.

You could install a bigger version of Visual Studio, but this would require a license. A simpler, faster and more cost-effective way is to use the test agent. You can find the installer for the test agent here in the docs at Microsoft.com.

This installer uses the familiar Visual Studio Installer, which probably will be needing an update before it can install the test agent. When everything is completed you can start your build and this time will get the code coverage for your test projects:

Still no test coverage? In this case check that you have selected the option to generate the test coverage in the execution options section. Without that your test agent will be unable to report the coverage. If that option is on but you still don’t get code coverage, switch to the Visual Studio 2015 version – that worked at least in my setup:

That now should definitely do the trick and get you the coverage data for your project.

 

Leave a Comment

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