Hello,
I’m trying to generate coverage to upload to sonar cloud.
tools I’m using.
- .Net Framwork 4.8
- SonarScanner.Msbuild.exe
- VStest.console.exe
- Coverlet
using github actions when workflow completes I can see .coverage file having data. (almost what I can read in the .coverage file is references to project files)
xml generated after running test: which seems empty and not generating any code coverage data.
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession>
<Summary numSequencePoints="0" visitedSequencePoints="0" numBranchPoints="0" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="1" minCyclomaticComplexity="1" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="0" />
<Modules />
</CoverageSession>
Steps I’m following.
-
setup required tools. e.g. actions/checkout, actions/setup-java, NuGet/setup-nuget, microsoft/setup-msbuild, darenm/Setup-VSTest and downloading sonar-scanner from link https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/6.0.0.81631/sonar-scanner-6.0.0.81631-net-framework.zip
-
SonarScanner.MSBuild.exe begin /k:APPLICATION_NAME /d:sonar.token=MY_VALID_TOKEN
-
msbuild Application.sln -t:rebuild -property:Configuration=Release
-
coverlet C:\a\Repos\App\ –target “vstest.console.exe” --targetargs “**\bin*.Test.Unit*dll /EnableCodeCoverage” --format “opencover” --output \coverage-reports\
-
SonarScanner.MSBuild.exe end /d:sonar.token=MY_VALID_TOKEN
In my application I’m unable to generate code-coverage.
.
.
.
and on other side,
I tried with a sample application with default template .Net Framework 4.8.
added few tests for default code.
which is working fine. In this sample application I can see coverage and xml as well. please have a look on below snapshot from sample app and github workflow.
In this sample application; I follow same steps, except SonarScanner.MSBuild.exe being and end.
Please help me here. I don’t know what I’m missing & what doing wrong here.
I’ve tried almost every possible solution from the community. also from the internet and end up with no result.
Thanks,
Hardik