Coverage not being found using coverlet/opencov format

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube -9.6.1.59531
    sonar-scanner-msbuild-5.8.0.52797-net5.0

Visual Studio
Microsoft Visual Studio Enterprise 2022
Version 17.1.3
VisualStudio.17.Release/17.1.3+32328.378
Microsoft .NET Framework
Version 4.8.04084
VisualStudio Enterprise

  • what are you trying to achieve
    import opencover coverage data.

  • what have you tried so far to achieve this
    My steps:
    dotnet test --filter TestCategory=UnitTest All.PayerEDI.TAS.sln -c Debug -v normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=“./coverage.opencov”

1)dotnet “C:\Users\OITPORAcreeJ\Desktop\sonar-scanner-msbuild-5.8.0.52797-net5.0\SonarScanner.MSBuild.dll” begin /k:“PayerEDI.TAS” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“sqp_78e81e12a776456a21f918bbf41cb5229eee16b8” /d:sonar.log.level=TRACE /d:sonar.cs.opencover.reportPaths=“PayerEDI.TAS.QA/**/.opencov, **/.opencov”

2)dotnet build All.PayerEDI.TAS.sln

3)dotnet “C:\Users\OITPORAcreeJ\Desktop\sonar-scanner-msbuild-5.8.0.52797-net5.0\SonarScanner.MSBuild.dll” end /d:sonar.login="sqp_78e81e12a776456a21f918bb

When I open the browser with http://localhost:9000/dashboard?id=PayerEDI.TAS 0.0% coverage
I see all the directories with valid .\coverage.opencov XML files. When I analyze the data, 0 %coverage

BTW: It would be helpful if the debug messages would actually tell you why it couldn’t find the opencov files and we could self diagnose this a little easier

I can send debug files upon request

Hi,

Welcome to the community!

Per the docs (emphasis mine):

Between the begin and end steps, you need to build your project, execute tests and generate code coverage data.

 
HTH,
Ann

Actually I tried this and still nogo but what I want to do is in the begin statement to point at a coverage opencover file directly without wild card and se if it can pick it up

Hi,

I believe you need to do both: in the begin command point to where the coverage file will be generated, then (build and) generate the file. Then call end.

 
HTH,
Ann