AZURE DEVOPS pipeline runs code coverage report, but results not visible in Sonar Cloud

Template for a good new topic, formatted with Markdown:

  • ALM used (Azure DevOps)

  • CI system used (Azure DevOps)

  • Scanner command used when applicable (private details masked)

    • task: SonarCloudPrepare@3
      displayName: ‘SonarCloud prepare’
    
      continueOnError: true
    
      inputs:
    
      SonarCloud: ‘sonarcloud_service_connection’
    
      organization: ‘XXXX’
    
      projectKey: ‘XXX’
    
      projectName: ‘XXX’
    
      projectVersion: ‘$(Build.BuildNumber)’
    
      extraProperties: |
    
      
        sonar.qualitygate.wait=${{ lower(parameters.sonarQualityGateFail) }}
      
        sonar.cs.cobertura.reportsPaths="$(Build.SourcesDirectory)/TestResults/coverage/coverage.cobertura.xml"
      
        sonar.verbose=true
    
    #       sonar.cs.vstest.reportsPaths=“$(Build.SourcesDirectory)/\*\*/\*.trx”
    #       sonar.cs.vscoveragexml.reportsPaths=$(Build.SourcesDirectory)/\*\*/coverage.xml
    
  • Languages of the repository .NET app

  • Error observed: My YAML pipeline runs green, it creates test report (percentage also visible in azure devops pipeline), but in SonarCloud, the project shows 0% code coverage.

In sonar cloud when I open the project to check details on code coverage summary report, it states: “There is not enough lines to compute coverage” even though I have 117 lines of code detected by Sonar.

I need this for a project, where I’m a fresh 3 weeks old DevOps engineer :slight_smile: Can someone please tell me, what do I need to change in my YAML?

Thank you!

Hi,

I’m not sure where you got sonar.cs.cobertura.reportsPaths, but that’s not a property we recognize. The .NET coverage docs should help.

 
Ann

I’ve built a new pipeline, just to test coverage, and used the document Ann linked above. Because I got results, I’m closing this thread. Thanks Ann!