TeamCity 6.5 Help

Configuring .NET Code Coverage

TeamCity supports following .NET code coverage tools:

  • JetBrains dotCover

  • NCover (1.x and 3.x)

  • PartCover (2.2 and 2.3)

When configured, code coverage summary is available on the Overview tab of the Working with Build Results. The detailed code coverage results are available on the dedicated Code Coverage tab of the Build Results. Coverage report can be downloaded on the Artifacts tab.

Depending how you run your unit tests on TeamCity there are several ways to configure code coverage.

Unit tests are run via NUnit, MSpec or MSTest build runner

If you have NUnit, MSpec or MSTest build step in your build configuration, you can simply add code coverage with prefered tool right in build runner settings. Just specify coverage options in TeamCity UI.

Unit tests in MSBuild

Code coverage on TeamCity is supported only if you run NUnit tests using NUnit for MSBuild. However, you can manually report code coverage reports.

Unit tests in NAnt

Code coverage is supported only if you run NUnit tests using NUnit for NAnt Build Runner.

Unit tests via .NET Process Runner

If you run unit tests using .NET Process Runner, for example, xUnit tests, you can add code coverage right in build runner settings.

Manually reporting code coverage to TeamCity

If neither of the described above cases suites your needs (for example, you run unit tests from Rake script), you can still configure code coverage reporting to TeamCity by means of service messages. Manually Configuring Reporting Coverage.

See also:

Administrator's Guide: NUnit Support

Last modified: 20 April 2023