Can not get code coverage report

dotnet
sonarqube
csharp
coverage

(Cemile) #1

Hi,
I want to import code coverage xml report to my SonarQube analysis results.
I have created simple jenkins pipline. I have implemented sonar.cs.opencover.reportsPaths property inside sonar-scanner.properties file for sonar-scanner-msbuild. But there was no code coverage result.
You can see my simple piplene image below.

When i implement it as windows batch command like image below it work fine.
I can get code coverage report.

Why there is no code coverage report when i implement my jenkins as first option.

Thank you in advance.

SonarQube: 7.3 and 7.4


(Colin Mueller) #2

You need to implement your code coverage analysis parameters into the “Additional Analysis” section of your SonarScanner for MSBuild - Begin Analysis step.


(Valeri Hristov) #3

I agree with @ColinHMueller that it is better to specify project- or build-specific values of the sonar.cs.opencover.reportsPaths property in the Additional Arguments text box, but if you want, you could set global value of the sonar.cs.opencover.reportsPaths property in the SonarQube.Analysis.xml file that’s located in the same directory where you installed Scanner for MSBuild (next to the SonarQube.Scanner.MSBuild.exe).

sonar-scanner.properties is taken into account only when you use the Scanner CLI to analyze non-.NET projects.


(Cemile) #4

Thank you very much both of you :hugs: