Code coverage not visible in SonarQube UI

Must-share information (formatted with Markdown):

  • Using SonarQube ADO Plugin
  • I am Trying to enable C# Code Coverage Reports

I have configured SonarCloudPrepare@2 with :

          sonar.cs.cobertura.reportsPaths=$(Build.SourcesDirectory)/**/coverage.cobertura.xml
          sonar.cs.vstest.reportsPaths=$(Build.SourcesDirectory)/**/*.trx
          sonar.sourceEncoding=UTF-8
          sonar.typescript.tsconfigPaths=**/tsconfig.json
          sonar.scm.provider=git
          sonar.exclusions=\
            **/bin/**,\
            **/obj/**,\
            **/node_modules/**

I build with:

dotnet test ${{test.projects}} --logger "trx;LogFileName=$projectDir.trx" --collect:"XPlat Code Coverage" --filter "$(targetTestsFilter)" ${{test.args}}

I SonarCloudAnalyze@2 and SonarCloudPublish with :

    - task: SonarCloudAnalyze@2
      displayName: 'Run SonarCloud analysis'
      inputs:
        organization: 'xxxxxx'
        projectKey: 'www.xxx.yyy.zzzzzzzz'
        projectName: 'FooBar'

I can see in the logs the code coverage reports not erroring ( there were errors initially as the content type was wrong)

In the UI I see my pull request but no coverage reports.

If I load the third party tool “dotnet tool install -g dotnet-reportgenerator-globaltool” I get

So the Build Options must be right.

Any help appreciated.

Hi,

It’s not clear to me where you got these parameters

The docs should help.

As a side note, there’s no need to provide

It’ll be picked up automatically from the environment.

 
HTH,
Ann