TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Manually Configuring Reporting Coverage

Last modified: 20 April 2023

If you use MSBuild, NAnt or Visual Studio (sln) runner and run your NUnit tests by means of NUnit Support, you can easily configure reporting code coverage right from the web UI. For the details refer to NCover and PartCover pages.

Since TeamCity 5.1 you can alternatively configure .NET coverage processing by means of service messages. This can be helpful, if you use a runner different from the listed above, for example, Rake, or if you run NUnit tests via test launcher other than TeamCity NUnit Test Launcher. To configure coverage reporting in your build script:

  1. Use the following service message template: ##teamcity[dotNetCoverage key='value'] where key is one of the following: For NCover 3.x:

    key

    description

    sample value

    ncover3_home

    Full path to NCover installation folder.

    Path to NCover3 installation directory

    ncover3_reporter_args

    Arguments for NCover report generator.

    //or FullCoverageReport:Html:{teamcity.report.path}

    For NCover 1.x:

    key

    description

    sample value

    ncover_explorer_tool

    Path to NCoverExplorer.

    Path to NCoverExplorer

    ncover_explorer_tool_args

    Additional arguments for NCover 1.x.

    ncover_explorer_report_type

    Value for /report: argument.

    1

    ncover_explorer_report_order

    Value for /sort: argument.

    1

    For PartCover:

    key

    description

    value

    partcover_report_xslts

    Write xslt transformation rules one per line (use |n as separator) in the following format: file.xslt=>generatedFileName.html.

    file.xslt=>generatedFileName.html

  2. To pass xml report generated by a coverage tool to TeamCity, in your build script use the following service message: ##teamcity[importData type='dotNetCoverage' tool='<tool name>' path='<path to the results file>'] where tool name can be partcover, ncover or ncover3.