Sonar-dotnet: OpenCover branchCoverage is measured but SonarQube "Uncovered Conditions" is missing

Created on 1 Aug 2018  Â·  9Comments  Â·  Source: SonarSource/sonar-dotnet

Description

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.

Repro steps

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

Expected behavior

Branch coverage numbers are not missing or zero.

Actual behavior

Branch coverage numbers are missing or zero.

Known workarounds

N/A

Related information

  • SonarC# Version: 7.1 (build 5212)
  • Scanner for MSBuild Version: 4.2.0.1214
  • SonarQube version: 6.7.1.35068
  • Usage: Standalone from PowerShell script
SQ Plugin New Feature

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.

All 9 comments

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

Was this page helpful?
0 / 5 - 0 ratings