Only coverage for test classes in opencover

2019-06-23 19:12发布

问题:

I have a problem to get the coverage from my classes with opencover.

I have a Viewer.dll with the main classes and a Viewer_Test.dll with the tests for the viewer.

After executing the commands all tests run as expected.

OpenCover.Console.exe -register:user -target:"$(nunitpath)/nunit-console-x86.exe" -targetargs:"/noshadow Viewer_Tests.dll /domain:single" -filter:+[*]* -output:coverage.xml

ReportGenerator.exe coverage.xml "coveragereport" html

If I look in the generated report I find only the test classes listed, not the main classes.

Here is the console output of the opencover command.

Committing...
Visited Classes 5 of 5 (100)
Visited Methods 41 of 41 (100)
Visited Points 482 of 557 (86.5350089766607)
Visited Branches 6 of 12 (50)

==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 5 of 5 (100)
Alternative Visited Methods 44 of 44 (100)

How can I make opencover to cover the Viewer.dll too?