Code coverage not updating in sonar cloud


we updated our DevOPs pipeline but still it not updating Code Coverage in sonar cloud. it always shows 0.0%. Need help


Hi @nitesh.barot and welcome to the community.

Can you please provide a bit more context ?
-Which kind of code do you analyse ? Was it working on the same project and branch before ?

  • Which build technology are you using ? How do you provide relevant paths to coverage files ?


Hi @mickaelcaro,

Thanks for the response.

We are analyzing Asp .Net 4.7 application. Sonar cloud analyzing is working fine but Code coverage is always 0.0%. And we are using Azure Dev Ops pipelines for build and deploy.

Can you please provider me more details or examples for Coverage file use?

Which tool are you using to execute your tests inside your pipeline ?

we are using XUnit framework for unit test.

Can you please apply this guide and see if it helps ?

Thanks !

This are the steps i have done:

  1. SonarCloudAnalyze
    And mentioned below settings:

         extraProperties: |
  2. Then - task: VSBuild@1
    it has below argument added

arguments: ‘–configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger trx’

    • task: VSTest@2
      with this settings:
      codeCoverageEnabled: true
      arguments: ‘–configuration ${{ parameters.BuildConfiguration }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger trx’
    • task: PublishTestResults@2


Don’t mix multiple sources of test coverage files (like you did in extraProperties), choose only one, otherwise it may lead to weird behaviors.


After removing extra entries I am getting below errors:

##[error]12:57:16.400 ERROR: Error during SonarScanner execution

##[error]Error during parsing of generic test execution report. Look at the SonarQube documentation to know the expected XML format.

##[error]Caused by: (The system cannot find the file specified)

Where is set this test-report path ?

This is how it is given:

This is how i am setting properties now:

        extraProperties: |                 
          sonar.projectBaseDir=$(System.DefaultWorkingDirectory)/Project Name


Just to summarize :

  • sonar.testExecutionReportPaths is a property to be set when you when to import generic test result files

  • If you are using VSTest inside your build pipeline, detection and setup of relevant properties should be made in an automatic manner

  • If you are using any other Test executable tool, you should add the relevant properties, according to the guide i gave the link above or this documentation

Hope that clarifies.



Just to confirm does VSTS supports .Net Framework 4.7 ? Because we are getting below errors:

##[debug]Exited vstest.console.exe with code 0.

##[debug]PERF: ExecuteVsTestPhase.InvokeVSTest: took 15215.5814 ms

Vstest.console.exe exited with code 0

No Result Found to Publish


Yes this is supported. This log is not related to SonarCloud though.

Those logs are related to VSTS task in pipeline.

But after that task in SonarCloudAnalyze below messages we are getting below messages:


Process returned exit code 0
Coverage report conversion completed successfully.
Process returned exit code 0

This property is intended to hold test result files, which should normally fill your number of test on SonarCloud. I would suggest to not set anything in your case since the Scanner will take care of finding those TRX by itself, them convert the binary file that is linked inside.

Let me know.


Ok i removed that setting but still it is not working.

Error message:

No test is available in D:\a\1\s\Application\TestProj.UnitTest\obj\Release\UnitTest.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

As per some articles do we need to install “Package NUnitTestAdapter” to resolve this ?