Test Coverage not published

I am using version 9.9.1 Community Edition of SonarQube. I have setup Azure pipeline. Every other thing is published on the SonarQube Dashboard except for Test Coverage. I have tried a couple of things but it does not work.
SonarQube is deployed to a Kubernetes cluster using Helm.
Below is the azure-pipeline.yml file I used.

trigger:
 branches:
   include:
    - master
 paths:
  include:
    -  src/Services/BillingSample/BillingSampleApi/*

pool:
  vmImage: windows-latest

variables:
  buildConfiguration: 'Release'

steps:
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: 'src/Services/BillingSample/BillingSampleApi'
    feedsToUse: config
    nugetConfigPath: src/Services/BillingSample/BillingRateApi/Nuget.Config
#prepare analysis configuration task
- task: SonarQubePrepare@5
  inputs:
    SonarQube: 'Sonarqube'
    scannerMode: 'MSBuild'
    projectKey: 'Billing-Sample-Service'
    projectName: 'Billing Sample Service'

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: 'src/Services/BillingSample/BillingSampleApi'

- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: 'src/Services/BillingSample/*[Tt]est/*.csproj'
    arguments: '--configuration $(BuildConfiguration) --collect:"Code Coverage"'

# Run Code Analysis task
- task: SonarQubeAnalyze@5

# Publish Quality Gate Result task
- task: SonarQubePublish@5
  inputs:
    pollingTimeoutSec: '300'

What am I missing?

What do the logs about importing coverage say?

1 Like

Thank you Colin for your response. I am using Azure DevOps and I am able to see the logs. I see a line “No report imported, no coverage information will be imported by JaCoCo XML Report Importer”, but I have shared the full log file. Thank you.
sonarlogs.txt (31.6 KB)

The relevant logs are actually here:

2023-06-06T13:49:35.1046482Z INFO: Sensor C# Tests Coverage Report Import [csharp]
2023-06-06T13:49:35.1047588Z INFO: Parsing the Visual Studio coverage XML report D:\a\_temp\ce156007-53b5-4e24-b8a7-bf1bfde61996\VssAdministrator_fv-az390-737_2023-06-06.13_42_46.coveragexml
2023-06-06T13:49:35.5774863Z INFO: Adding this code coverage report to the cache for later reuse: D:\a\_temp\ce156007-53b5-4e24-b8a7-bf1bfde61996\VssAdministrator_fv-az390-737_2023-06-06.13_42_46.coveragexml
2023-06-06T13:49:35.5776872Z INFO: Coverage Report Statistics: 1 files, 0 main files, 0 main files with coverage, 1 test files, 0 project excluded files, 0 other language files.
2023-06-06T13:49:35.5777748Z WARN: The Code Coverage report doesn't contain any coverage data for the included files. Troubleshooting guide: https://community.sonarsource.com/t/37151
2023-06-06T13:49:35.5778264Z INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=469ms

So it appears a coverage report was found, but that it only contains coverage for a single test file.

Do you expect other coverage files to be produced than D:\a_temp\VssAdministrator_fv-az390-737_2023-06-06_13_44_59\In\fv-az390-737\VssAdministrator_fv-az390-737_2023-06-06.13_42_46.coverage?