TeamCity Cloud 2024.03 Help

PartCover

TeamCity supports code coverage with PartCover (2.2 and 2.3) for NUnit tests run via the TeamCity NUnit test runner, which can be configured in one of the following ways: via the web UI, TeamCity NUnit Test Launcher, NUnit for MSBuild, NUnit for MSBuild, NUnit for NAnt Build Runner.

Important Notes

  • In order to launch coverage, PartCover should be installed on an agent where coverage builds will run.

  • You don't need to make any modifications to your build script to enable coverage.

  • You don't need to explicitly pass any of the PartCover arguments to the TeamCity NUnit test runner.

To configure PartCover:

  1. While creating/editing Build Configuration, go to the Build Runner page.

  2. Select PartCover (2.2 or 2.3) as a .NET coverage tool.

  3. Select the .Net runtime platform and version.

  4. Set up the PartCover options — find the description of the available options below.

Option

Description

Path to PartCover

Specify the path to PartCover installed on a build agent, or the corresponding system property, if configured.

Additional PartCover Arguments

Specify additional PartCover arguments, excluding the ones that can be specified using the web UI. Do not specify here the output path for the generated reports, because TeamCity configures it automatically.

Include Assemblies

Explicitly specify the assemblies to profile, or use [*]* to include all assemblies.

Exclude Assemblies

Explicitly specify the assemblies to be excluded from coverage statistics. If you have specified [*]* to profile all assemblies, type [JetBrains*]* here to exclude TeamCity NUnit test runner sources.

Report XSLT

Write new-line delimited xslt transformation rules in the following format: file.xslt=>generatedFileName.html. You can use the default PartCover xslt as file.xslt, or your own. The Xslt files path is relative to the build checkout directory.

Reporting PartCover Results Manually

If .NET code coverage is collected by the build script and needs to be reported inside TeamCity (for example, Rake, or if you run tests via a test launcher other than TeamCity NUnit Test Launcher), there is a way to let TeamCity know about the coverage data. Read more in Manually Configuring Reporting Coverage.

Last modified: 24 April 2022