3
votes

On OpenCover github page I can see that OpenCover supports coverage by test ("Release 3 (coverage by test support, debug symbols"). The issue is, I don't know how to run OpenCover with this option. My workflow is to run unit tests with OpenCover and nUnit, then use ReportGenerator to generate full html report and view it - and I can't see the "coverage by test" anywhere.

Or maybe I got the "coverage by test" feature wrong? How I imagine this feature is that I can get an answer to a question such as "which lines of code does my TestXYZ() cover?".

Can anyone give me some tips on how to use the feature?

2

2 Answers

5
votes

I submitted this as an issue to Daniel Palme, who is responsible for Report Generator and he actually agreed to add support for this capability! What's more, he already put it into the repository (http://reportgenerator.codeplex.com/SourceControl/changeset/70732).

What a great guy!

4
votes

You will need to use the -coverbytest switch should be detailed in the Usage.rtf guide - it uses the same sort of filters as used for coverage inclusion/exclusion.

However ReportGenerator does not support OpenCover's Coverage By Test feature - you will need to write your own reporting for this - the XML from OpenCover is easy to understand though.

Choose the test method and then locate which lines of code those test methods are recorded against.