TeamCity On-Premises
 
Get TeamCity On-Premises

Manually Configuring Reporting Coverage

Edit pageLast modified: 18 September 2024

If you run .NET tests using NUnit, MSpec or .NET Process Runner runners or run NUnit tests via supported tasks of MSBuild or NAnt runners, you can turn on coverage collection in the TeamCity web UI for the specific runner.

For other cases, when the .NET code coverage is collected by the build script and needs to be reported inside TeamCity (for example, Rake, or if you run NUnit tests via a test launcher other than TeamCity NUnit Test Launcher), there is a way to let TeamCity know about the coverage data.

Make sure the build script actually collects the code coverage according to the coverage engine documentation.

Report the collected data to TeamCity via Build Script Interaction.

First, the build script needs to let TeamCity know details on the coverage engine with the "dotNetCoverage" message.
Then, the build script can issue one or several "importData" messages to import the actual code coverage data files collected.
As a result, TeamCity will display coverage statistics and an HTML report for the coverage.