Coverage stopped being picked up, not sure what went wrong

  • SonarQube server: 10.7.0.96327
  • SonarScanner: 5.0.1.3006
  • SonarSource: 7.0.3
  • sonarqube-extension-for-azure-devops
  • Java 17.0.11 Eclipse Adoptium (64-bit)
  • Windows Server 2022 10.0 amd64

I can see both test results trx files that have been generated by the pipeline in the logs as well as the two coveragexml files. But the result is always 0% code coverage. I have also checked that the newly written tests go through the new code and they do.

Not sure why it is reporting 0% coverage, but it has started happening on one project only within the last week. No changes to build process, but change was made to use Microsoft.TestPlatform&version=17.11.1 in the cake file that runs and produces the test files.

Thanks in advance for any help that can be given.
Log.txt (2.5 MB)

What version were you using before? Does switching it back have an impact?

Hi Colin,

Thanks for the response. We where using v=16.9.4 beforehand. Switching back has not solved our issue though so looks unrelated.

Thanks.

2024-10-31T17:07:22.0069010Z INFO: Sensor C# Tests Coverage Report Import [csharp]
2024-10-31T17:07:22.0083401Z INFO: Parsing the Visual Studio coverage XML report C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_53_17\In\eu1vs22000VRR\AzDevOps_eu1vs22000VRR_2024-10-31.16_54_02.coveragexml
2024-10-31T17:07:22.0364574Z INFO: Adding this code coverage report to the cache for later reuse: C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_53_17\In\eu1vs22000VRR\AzDevOps_eu1vs22000VRR_2024-10-31.16_54_02.coveragexml
2024-10-31T17:07:22.0366020Z INFO: Parsing the Visual Studio coverage XML report C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_59_31\In\eu1vs22000VRR\AzDevOps_eu1vs22000VRR_2024-10-31.17_03_44.coveragexml
2024-10-31T17:07:22.0367723Z INFO: Adding this code coverage report to the cache for later reuse: C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_59_31\In\eu1vs22000VRR\AzDevOps_eu1vs22000VRR_2024-10-31.17_03_44.coveragexml
2024-10-31T17:07:22.0369163Z INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=16ms
2024-10-31T17:07:22.0369800Z INFO: Sensor C# Unit Test Results Import [csharp]
2024-10-31T17:07:22.0373459Z INFO: Parsing the Visual Studio Test Results file 'C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_53_17.trx'.
2024-10-31T17:07:22.0728729Z INFO: Parsing the Visual Studio Test Results file 'C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_59_31.trx'.
2024-10-31T17:07:22.0813069Z INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=46ms

My first two suggestions are:

  • Examine this file (C:\a\2\s\TestResults\AzDevOps_eu1vs22000VRR_2024-10-31_16_59_31\In\eu1vs22000VRR\AzDevOps_eu1vs22000VRR_2024-10-31.17_03_44.coveragexml) to see if it actually contains coverage data. SonarQube doesn’t do anything special with coverage data other than read the file it’s given. If this file contains no coverage data… SonarQube won’t be able to detect it. At that point, you know the issue is with your coverage tool and the priority and getting the report back in shape.
  • Turn on DEBUG logging (sonar.verbose=true), which offers more detailed logging on the coverage import.

If you have any scanner logs from before the coverage dropped to 0, that’s also helpful to compare if something else changed.

Thanks for your help.

Was able to get access to the the coveragexml file and it is empty. Looks like it is the coverage tool having issues.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.