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.
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:
While creating/editing Build Configuration, go to the Build Runner page.
Select PartCover (2.2 or 2.3) as a .NET coverage tool.
Select the .Net runtime platform and version.
Set up the PartCover options - find the description of the available options below.
Path to PartCover
Specify the path to PartCover installed on a build agent, or the corresponding Configuring Build Parameters, 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.
Explicitly specify the assemblies to profile, or use
Explicitly specify the assemblies to be excluded from coverage statistics. If you have specified
Write new-line delimited xslt transformation rules in the following format:
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.