0
votes

I am using Opencover and Reportgenerator to find out the code coverage of my C# project. Currently I am able to get 100% coverage for my unit test but I want to know how much code has been covered by unit test file (I think there is a way in opencover)?

Say my unit test covers only 50% of my script, then I want opencover to report that.

I am using the following command on .bat file to run opencover and reportgenerator (I tried all possible parameters on opencover but failed to get what I needed)

"..\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe" -target:"..\packages\nunit.consolerunner\3.8.0\tools\nunit3-console.exe" -targetargs:".\bin\Debug\UserAuthUnitTest.dll" -register:path64 -mergebyhash -nodefaultfilters -oldstyle -showunvisited -log:verbose -filter:+[*]* -safemode:no -output:"CodeCoverageResult.xml"
"..\packages\ReportGenerator.3.1.2\tools\ReportGenerator.exe" "-reports:CodeCoverageResult.xml" "-reporttypes:Badges;HtmlSummary" "-verbosity:Verbose" "-targetdir:CodeCoverageReport"

and I am currently getting following: output on reportgenerator

1

1 Answers

0
votes

Have a look at the xml file that OpenCover produces. It will provide a reason why it skipped your assembly.

Male sure your assembly produces a pdb file (full) and that it is in the same folder as the assembly.

Use the filters to ignore assemblies (see wiki)