Sonarqube not read opencover report

  • What version are you upgrading from?
    Sonarqube 9.9
  • System information (Operating system, Java version, Database provider/version)
    Microsoft Windows Server 2022、Java 11.0.17 、 Microsoft SQL Server 2017
  • What’s the issue you’re facing?
    My Sonarqube report cannot read the xml report produced by opencover
    Coverage shows 0

Below is my command

"%SonarScanner_PATH%\SonarScanner.MSBuild.exe" begin /k:"SONARQUBE_TEST" /v:COVERAGE_TEST /d:sonar.host.url="IP:Port" /d:sonar.login="%Sonarqube_bin%" /d:sonar.branch.name=COVERAGE /d:sonar.cs.opencover.reportsPaths=%opencover_report_PATH%\opencover.xml

%MSBuild_PATH%\MSBuild.exe /t:Rebuild

"%Opencover_PATH%\OpenCover.Console.exe" -target:"%nunit3_PATH%\nunit3-console.exe" -targetargs:"%UNIT_TEST_DLL_PATH%\Server.UnitTest.dll" -register:user -output:"%opencover_report_PATH%\opencover.xml"

"%SonarScanner_PATH%\SonarScanner.MSBuild.exe" end /d:sonar.login="%Sonarqube_bin%"

I use reportgenerator to generate a test report.

But Sonarqube doesn’t show coverage.

Any ideas ?

Regards,
Ian

What do the logs about importing code coverage say? Take a look here to find them.

Sorry,I have found a solution.

but I don’t know how to close Topic.

please close.

I found that COVERAGE is on UNIT_TEST, and SONARQUBE excludes the test folder, resulting in COVERAGE being 0

Modify UNIT_TEST to get COVERAGE

Thank you for your answer.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.