Features Tips & Tricks

Reporting .NET Coverage from Any Runner

In the previous post about .NET coverage, we’ve told about configuring NCover/PartCover settings right in the web UI. This solution suits perfectly well for those, who use MSBuild, NAnt or Visual Studio (sln) runner. However, since version 5.1, you can get the coverage results displayed in TeamCity, even if you use a runner other than listed above.
If your build produces coverage report .xml files, you can populate your build script with simple service messages – and voila! TeamCity will merge those coverage reports, publish statistics and generate html-report for you.

Start with configuring TeamCity .NET Coverage reporting parameters in your build:

##teamcity[dotNetCoverage key='value']

where key is a .NET Coverage reporting parameter (the complete list of the values can be found in our docs).  Make sure to set up all parameters before reporting coverage .xml files.

Now, to pass generated coverage .xml files to TeamCity, use the following service message:

##teamcity[importData type='dotNetCoverage' tool='<tool name>' path='<path to the results file>']

where tool name can be partcover, ncover or ncover3. Hope, you’ll find it useful.

Stay tuned for TeamCity 5.1!

Sincerely, The JetBrains TeamCity team

image description