TeamCity 9.0 Help

JetBrains dotCover

TeamCity comes bundled with the console runner of JetBrains dotCover. By enabling the configuration option, you can collect code coverage for your .Net project and then view the coverage statistics and detailed coverage report inside the TeamCity web UI.

If you have a license for dotCover and have it installed on a developer machine, TeamCity-collected coverage results can be downloaded and viewed inside Visual Studio with the help of the TeamCity Visual Studio Add-in.

dotCover Settings

Path to dotCover Home

Leave this field blank to use the bundled dotCover. Alternatively, specify the path to the dotCover installed on a build agent.

Filters

Specify assemblies to profile - one per line - using the following syntax: +:assembly=*;type=*;method=***. Use -:assembly to exclude an assembly from code coverage. The asterisk wildcard (*) is supported here.

Attribute Filters

If you don't want to know the coverage data solution-wide, you can exclude the code marked with an attribute (for example, with ObsoleteAttribute) from the coverage statistics. You only need to specify these attribute filters here in the following format: - the filters have to be a new-line separated list; - the-:attributeName syntax has to be used to exclude the code marked with the attributes from code coverage. Use the asterisk (*) as a wildcard if needed. Supported only for dotCover 2.0 or newer.

Additional dotCover.exe arguments since TeamCity 9.1

Provide a new-line separated list of additional command line parameters to pass to dotCover.exe

Note that dotCover coverage engine reports statement coverage instead of line coverage.

Compile and Test in Different Builds

To build a consistent coverage report, dotCover has to be able to find source files under the build checkout directory which should be easy if you build binaries and collect coverage in the same build, or if you use different builds, but they use a snapshot dependency and the same agent as well as the same VCS settings.

If you need to build binaries in one build and collect code coverage in another one using different checkout settings, some additional properties are required. It is assumed that:

  • Build configuration A compiles code with debugging information and creates an artifact with assemblies and .pdb files

  • Build configuration B runs tests with dotCover enabled and has a snapshot dependency on A.

To display the source code in the Code Coverage tab of build results of B, you need to point B to the same VCS root as A to get your source code in an appropriate location (the checkout root) and add an artifact dependency on build from the same chain of A (for dotCover to get the paths to the sources from the .pdb files).

You also need to tell TeamCity where to find the source code. To do this, perform the following:

  1. Add the teamcity.dotCover.sourceBase configuration parameter with the value %\teamcity.build.checkoutDir% to the compiling build configuration A.

  2. Add the configuration parameter dotNetCoverage.dotCover.source.mapping to your test configuration B with the value %\dep.btA.teamcity.dotCover.sourceBase%=>%\teamcity.build.checkoutDir%, where btA is the actual id of your configuration A.

Bundled dotCover Versions

This section provides information on the versions of dotCover bundled with different TeamCity versions.

TeamCity Version

dotCover Version

TeamCity 9.1.7

dotCover 2016.1

TeamCity 9.1.6

dotCover 10.0.2

TeamCity 9.1.5

dotCover 10.0.2

TeamCity 9.1.4

dotCover 10.0

TeamСity 9.1.3

dotCover 3.2

TeamСity 9.1.1

dotCover 3.1.1

TeamСity 9.1

dotCover 3.1.1

TeamCity 9.0.4

dotCover 3.0

TeamCity 9.0.3

dotCover 3.0

TeamCity 9.0.2

dotCover 3.0

TeamCity 9.0

dotCover 2.7

TeamCity 8.1.4

dotCover 2.7

TeamCity 8.1

dotCover 2.6

TeamCity 8.0.6 (and later 8.0.x)

dotCover 2.6

TeamCity 8.0.5

dotCover 2.5

TeamCity 8.0

dotCover 2.2

TeamCity 7.1.3 (and later 7.1.x)

dotCover 2.2

TeamCity 7.1.2

dotCover 2.1

TeamCity 7.1

dotCover 2.0

TeamCity 7.0.1 (and later 7.0.x)

dotCover 1.2

TeamCity 7.0

dotCover 1.1

TeamCity 6.0

dotCover 1.0

Last modified: 20 April 2023