In my current setup code coverage appears to be properly measured and submitted to SonarQube, as it gets properly displayed. However, although my "opencover.xml" includes branchCoverage numbers, the SonarQube server is not showing anything for branch coverage. For overall file statistics "Uncovered Conditions" is a dash (–) and for new code "Conditions to Cover on New Code" and "Uncovered Conditions on New Code" are both 0.
Followed the official documentation for setting up my build analysis. I'm using a PowerShell script with roughly the following relevant commands:
$SonarQubeExePath begin /k:my_proj /n:my_proj /v:"$NewAssemblyFileVersion" /d:sonar.scm.provider=hg /d:sonar.cs.opencover.reportsPaths="opencover.xml" /d:sonar.cs.vstest.reportsPaths="TestResults/*.trx" /d:sonar.exclusions="Content/**/*.css,Scripts/**/*.js,Scripts/**/*.ts,GlobalSuppressions.cs" /d:sonar.cpd.exclusions="Content/**/*.css,Scripts/**/*.js,Scripts/**/*.ts,GlobalSuppressions.cs,Properties/AssemblyInfo.cs,App_Start/RouteConfig.cs"
and
$OpenCoverExePath -output:opencover.xml -register:user -target:"$VSTestExePath" -targetargs:"/Logger:trx $TestDLL /TestAdapterPath:$TestDLLPath" -filter:'+[*]* -[Proj1Name]* -[Proj2Name]* -[Proj3Name]*'
At the end of the analysis I see the following:
INFO: Parsing the OpenCover report C:\src\my_proj\.\opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: C:\src\my_proj\.\opencover.xml
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=304ms
Branch coverage numbers are not missing or zero.
Branch coverage numbers are missing or zero.
N/A
This is a cross-post of https://github.com/SonarSource/sonar-scanner-msbuild/issues/501
Seems to be related to #1213
Since this issue has been removed from the 7.10 release. Is there any indication on when this will be implemented?
@Evangelink any updates?
Hi @HubertKooij , no ETA for this yet. We do not support conditional coverage yet.
@andrei-epure-sonarsource Any updates on this or any workaround, i.e. using a different coverage format? Having no branch coverage in Sonarqube kinda defeats the purpose of importing coverage into Sonarqube in the first place.
thanks for the follow-up, @jasper-d
I totally agree with you, this is bothering me as well during our daily development.
We will do the specification work in the following period. However, I don't have an ETA.
@andrei-epure-sonarsource Thank you, appreciate it!
the specification for what needs to be done is in https://jira.sonarsource.com/browse/MMF-1997
Most helpful comment
thanks for the follow-up, @jasper-d
I totally agree with you, this is bothering me as well during our daily development.
We will do the specification work in the following period. However, I don't have an ETA.