Question

We have a project using C#, C++/Cli and some native C++ code. We use TeamCity for building and testing.

We run the tests using vstest.console (VS2012 test runner).

For managed code, dotCover (which is integrated into TeamCity) is used for code coverage. However, it doesn't work with native C++ code (which is to be expected).

How do I get code coverage results our unit tests for the native C++ parts into TeamCity? Ideally, the solution would be free.

Was it helpful?

Solution

We use Bullseye Coverage for C++ code coverage. We then use the provided covxml tool to convert the binary coverage files into an XML file, which we then read out a bunch of useful attributes for function and conditional coverage (e.g. fn_total, fn_cov, cd_total, cd_cov) and provide these to TeamCity via the statistics service messages using the predefined coverage keys.

It was a bit of work to set up, but I think TeamCity still has no support for any C++ coverage tool, so our solution still works well for us years later.

Edit: I've uploaded the XML parsing code for our in-house tool to a Gist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top