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?

Hi,

Welcome to the community!

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

 
Ann

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'
            inputs:
              SonarQube: Sonarqube
              projectKey: MyProject
              projectVersion: '$(Build.BuildNumber)'
              extraProperties: |
                sonar.links.scm=https://XXX@dev.azure.com/Repo
                sonar.exclusions=external/**
                sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)/**/*.coveragexml
                sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx
          # test
          - task: DotNetCoreCLI@2
            displayName: 'Run UnitTests'
            inputs:
              command: test
              projects: |
                **\*Test.csproj
                !**/*CustomAction.Test.csproj
              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