Posting Code Coverage test results to TeamCity from script...

In order to gain some continuity between local development and CI server environment we changed our CI strategy to running our build process from the confines of a MSBuild script rather than utilizing TeamCity plugin/task services.
Before this move we were using the dotCover service in TC to report code coverage metrics. I've changed this so we now have a MSBuild target that will run an  OpenCover process followed by processing the results through ReportGenerator that will churn out the html assets for viewing the results.
Locally this can be executed and will start a browser with the index.htm of the generated report automatically.
I would like to extend this so that we can identify when running the script under the TeamCity instance, and if so, publish this report to TeamCity for viewing directly within the TeamCity dashboard.
I'm relatively this is possible but not clear on:
1) How to determine we're running within TeamCity and
2) What gets published to TeamCity and how.

Any help would be greatly appreciated.

Comment actions Permalink

Hi Karl,

To publish .html report in TeamCity you should publish the report as the build artifact to the server and then configure the Report Tab.
Also we have a related feature request -, please vote for it.

Comment actions Permalink

Thanks Alina, personally I think that adding this support natively to TeamCity is a good idea (and I voted for it), but my need is to have this same report generated for both our local dev environment as well as build via our MSBuild script so I'm not so interested (for our current need) to have the ability to set this up as a TeamCity task.

Thanks for the link. I saw this before but had some issues finding it again.


Please sign in to leave a comment.