Importing Arbitrary Coverage Results to TeamCity
TeamCity comes bundled with the following coverage engines: IntelliJ IDEA, Emma, JaCoCo for Java and dotCover, NCover, PartCover for .NET. If you use these platforms, TeamCity will provide a code coverage automatically.
It is possible to achieve a similar experience with tools that are not supported out of the box. There are two options:
Publish a coverage HTML report as a TeamCity build artifact.
Most of the tools produce coverage reports in HTML — you can publish such a report as an artifact and configure the Report tab to display it in TeamCity. The coverage should be published to anindex.html
file inside thecoverage.zip
archive and put in the artifacts root directory. In this case, the Report tab will appear automatically.Extract and publish statistics
You can extract coverage statistics from a coverage report and publish statistical values to TeamCity using service messages. In this case, the coverage chart will be displayed on the build configuration Statistics tab.
This approach also allows failing a build based on build failure condition on a metric change (for example, you can fail build if the coverage drops).
See also how to integrate TeamCity with an arbitrary test reporting tool.