Coverage issue in build pipeline when using SonarCloud extension in AzureDevOps

vsts

(Adrian Ng) #1

Hi , guys, I am using the “coverlet” to generate the coverage report:
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

It generates the ‘coverage.opencover.xml’ for me.

I have the “sonar.cs.vscoveragexml.reportsPaths=**/*.opencover.xml” in the “Prepare analysis on SonarCloud” task in build pipeline.

But it throws the following errors :

2018-10-02T02:40:03.3998260Z ##[error]ERROR: Error during SonarQube Scanner execution

ERROR: Missing root element <results> in D:\a\1\.\s\ReactCore.Tests.Unit\coverage.opencover.xml at line 2

ERROR:

2018-10-02T02:40:03.4267591Z ERROR: Error during SonarQube Scanner execution

2018-10-02T02:40:03.4267971Z ERROR: Missing root element <results> in D:\a\1\.\s\ReactCore.Tests.Unit\coverage.opencover.xml at line 2

Could anyone please tell me what is the right way to get the coverage report to pass to the SonarCloud ?

Thanks


(Amaury Levé) #3

Hi @Adrian_Ng,

As specified in the documentation you need to use /d:sonar.cs.opencover.reportsPaths for OpenCover and not /d:sonar.cs.vscoveragexml.reportsPaths (which is for VS Coverage).

Cheers,
Amaury