Sonarqube Showing 0.00 % code coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Am told SQ configurations are all correct. How to map back to a missing test DLL code to existing SQ code in Azure repo scan?


Welcome to the community!

There are several guides about .NET coverage that might help.


Which language? Which compiler? How do you build your code?

I also observed a drop to 0.0% when upgrading NuGets in C# for Microsoft.NET.Test.Sdk from 17.1 to 17.2. Haven’t yet tried with the new 17.3.
Targetframework for my test projects is still netcoreapp3.1 and using SQ 9.4.

1 Like

C#, thanks, would like to add the missing DLL test location to the exiting SQ scan. I know SQ can only look at one file at a time. Would that work, and how?

From a working Azure DevOps build pipeline the 2 most important tasks:

          - task: SonarQubePrepare@5
            displayName: 'Prepare analysis on SonarQube'
              SonarQube: Sonarqube
              projectKey: MyProject
              projectVersion: '$(Build.BuildNumber)'
              extraProperties: |
          # test
          - task: DotNetCoreCLI@2
            displayName: 'Run UnitTests'
              command: test
              projects: |
              arguments: '-c $(BuildConfiguration) --filter TestCategory!=IntegrationTest --collect "Code coverage"'
              testRunTitle: 'Unittest'
              publishTestResults: true
              nobuild: true

And you can have multiple test projects with each a coveragexml file.

1 Like