Visual Studio 2019 Community Edition Project Framework 4.5 My Environment: Windows Server 2016 Expected Behavior: Expected to show code coverage as the covered percentage. Actual Behavior: The Code coverage is always shown as 0
Command Used :
OpenCover.Console.exe -target:"<PATH>\xunit.runner.console.2.4.1\tools\net472\xunit.console.x86.exe" -targetargs:"<PATH>\bin\Debug\PROJECT_Tests.dll" -register:user -output:"<PATH>\bin\Debug\TestResults\OpenCover\coverage.xml"
I have tried the same with vstest runner also.
In cmd, the output is shown as :
=== TEST EXECUTION SUMMARY === PROJECT_Tests Total: 11, Errors: 0, Failed: 0, Skipped: 0, Time: 118.717s Committing... Visited Classes 235 of 1338 (17.56) Visited Methods 942 of 17022 (5.53) Visited Points 2632 of 58653 (4.49) Visited Branches 1607 of 36315 (4.43)
==== Alternative Results (includes all methods including those without corresponding source) ==== Alternative Visited Classes 235 of 1570 (14.97) Alternative Visited Methods 942 of 18541 (5.08)
But, when checking the coverage.xml file or using report generator (v4.5.0) we generate the report all the files are shown as 0% coverage.
<Method visited="false" cyclomaticComplexity="4" nPathComplexity="2" sequenceCoverage="0" branchCoverage="0" crapScore="20" isConstructor="false" isStatic="false" isGetter="false" isSetter="false">
<Summary numSequencePoints="8" visitedSequencePoints="0" numBranchPoints="3" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="4" minCyclomaticComplexity="4" maxCrapScore="20" minCrapScore="20" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="1" />
<MetadataToken>100664627</MetadataToken>
<Name>project.BusinessEntities.CoordinationNotes.CoordinationNotesInfo project.CoordinationNotes.DalCoordinationNotes::GetDetails(project.BusinessEntities.SystemManagement.GeneralRequest,project.BusinessEntities.Member.MemberTaskList&,System.Object&)</Name>
<FileRef uid="2505" />
<SequencePoints>
<SequencePoint vc="0" uspid="75974" ordinal="0" offset="0" sl="38" sc="9" el="38" ec="10" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75975" ordinal="1" offset="1" sl="39" sc="13" el="39" ec="131" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75976" ordinal="2" offset="44" sl="41" sc="20" el="41" ec="56" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75977" ordinal="3" offset="56" sl="42" sc="13" el="42" ec="14" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75978" ordinal="4" offset="57" sl="43" sc="17" el="43" ec="75" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75979" ordinal="5" offset="72" sl="45" sc="17" el="45" ec="115" bec="2" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75980" ordinal="6" offset="99" sl="47" sc="17" el="47" ec="29" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75981" ordinal="7" offset="114" sl="49" sc="9" el="49" ec="10" bec="0" bev="0" fileid="2505" />
</SequencePoints>
<BranchPoints>
<BranchPoint vc="0" uspid="75982" ordinal="0" offset="79" sl="45" path="0" offsetend="81" fileid="2505" />
<BranchPoint vc="0" uspid="75983" ordinal="1" offset="79" sl="45" path="1" offsetend="84" fileid="2505" />
</BranchPoints>
<MethodPoint xsi:type="SequencePoint" vc="0" uspid="75974" ordinal="0" offset="0" sl="38" sc="9" el="38" ec="10" bec="0" bev="0" fileid="2505" />
</Method>
Any suggestions? What am I doing wrong? Or any alternative for Code coverage in c# community Edition?