I've noticed that TeamCity does not support any of the output formats currently offered by this tool and the ReportGenerator tool. It would be a simple thing to add some support for writing TeamCity service messages out to the console, since we already print some statistics.
Some Statistics that are easily supported:
| TeamCity Statistic Key | Description |
| :--- | :----: |
| CodeCoverageL | Line Coverage |
| CodeCoverageC | Class Coverage |
| CodeCoverageM | Method Coverage |
| CodeCoverageAbsLTotal | The total number of lines |
| CodeCoverageAbsLCovered | The number of covered lines |
| CodeCoverageAbsCTotal | The total number of classes |
| CodeCoverageAbsCCovered | The number of covered classes |
| CodeCoverageAbsMTotal | The total number of methods |
| CodeCoverageAbsMCovered | The number of covered methods |
Some statistics that would require extra work to support:
| TeamCity Statistic Key | Description |
| :--- | :----: |
| CodeCoverageS | Statement Coverage |
| CodeCoverageB | Block Coverage |
| CodeCoverageR | Branch Coverage |
| CodeCoverageAbsSTotal | The total number of statements |
| CodeCoverageAbsSCovered | The number of covered statements |
| CodeCoverageAbsBTotal | The total number of blocks |
| CodeCoverageAbsBCovered | The number of covered blocks |
| CodeCoverageAbsRTotal | The total number of branches |
| CodeCoverageAbsRCovered | The number of covered branches |
See the documentation here for more info about TeamCity service messages
See the documentation here for more info about TeamCity statistics
Essentially all that would need to be added would be a few lines like:
Console.WriteLine("##teamcity[buildStatisticValue key='CodeCoverageC' value='39.6']");
Console.WriteLine("##teamcity[buildStatisticValue key='CodeCoverageAbsCCovered' value='53']");
Console.WriteLine("##teamcity[buildStatisticValue key='CodeCoverageAbsCTotal' value='134']");
and a command line switch to toggle this output. A good example of this can be found in a blog post here
BTW Reptarsrage is my other account, and the PR for this is #227
@tonerdo What's the eta for the next release?
See latest release: https://www.nuget.org/packages/coverlet.msbuild/2.3.2
Good start. Would be great to get an in-depth view that was on parity with the other formats.
Seems TC has service message support for sucking in a file:
where tool name can be partcover, ncover or ncover3. (or Teamcity's coverage.xml format)
@gilescope You should open a new issue that can be tracked/prioritized by the code owners, if you haven't done that already.
Most helpful comment
See latest release: https://www.nuget.org/packages/coverlet.msbuild/2.3.2