Could not find any coverage report file matching the pattern

Hi @Jeremie ,

From the pertinent logs:

2021-07-08T10:47:05.6819194Z 10:47:05.671 INFO: Sensor C# Tests Coverage Report Import [csharp]
2021-07-08T10:47:05.6820350Z 10:47:05.680 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir 'D:\a\1\.' and file separator '\'.
2021-07-08T10:47:05.6830792Z 10:47:05.682 DEBUG: Pattern matcher extracted prefix/absolute path 'D:\a\_temp' from the given pattern 'D:\a\_temp\**\*.coveragexml'.
2021-07-08T10:47:05.6841138Z 10:47:05.682 DEBUG: Gathering files for wildcardPattern '**\*.coveragexml'.
2021-07-08T10:47:06.0600925Z 10:47:06.058 DEBUG: Pattern matcher returns '0' files.
2021-07-08T10:47:06.0607718Z 10:47:06.059 WARN: Could not find any coverage report file matching the pattern 'D:\a\_temp\**\*.coveragexml'. Troubleshooting guide: https://community.sonarsource.com/t/37151
2021-07-08T10:47:06.0612240Z 10:47:06.059 DEBUG: Analyzing coverage after aggregate found '0' coverage files.
2021-07-08T10:47:06.0614019Z 10:47:06.059 DEBUG: The total number of file count statistics is '0'.
2021-07-08T10:47:06.0615836Z 10:47:06.059 INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=388ms
2021-07-08T10:47:06.0617161Z 10:47:06.060 INFO: Sensor C# Unit Test Results Import [csharp]
2021-07-08T10:47:06.0660159Z 10:47:06.062 DEBUG: Pattern matcher extracted prefix/absolute path 'D:\a\_temp' from the given pattern 'D:\a\_temp\**\*.trx'.
2021-07-08T10:47:06.0688246Z 10:47:06.062 DEBUG: Gathering files for wildcardPattern '**\*.trx'.
2021-07-08T10:47:06.2896697Z 10:47:06.288 DEBUG: Pattern matcher returns '0' files.
2021-07-08T10:47:06.2916333Z 10:47:06.290 INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=230ms

I believe your analysis parameters for the reportPaths is looking for *.trx and *.coveragexml files within the $(Agent.TempDirectory) as shown here:

sonar.cs.vstest.reportsPaths=D:\a\_temp\**\*.trx
sonar.cs.vscoveragexml.reportsPaths=D:\a\_temp\**\*.coveragexml

But in Task “9 Run unit tests and Publish report on pipeline”, the *.trx file is in a different directory:

2021-07-08T10:43:16.9579233Z Results File: D:\a\1\s\TestResults\VssAdministrator_WIN-OPGFMDA7R6A_2021-07-08_10_43_15.trx

In Task “11 Run code coverage”, you generated a coverage.cobertura.xml file, which is not an accepted format for SonarCloud and C# coverage:

2021-07-08T10:45:04.7381845Z   Generating report 'D:\a\_temp\TestResults\coverage.cobertura.xml'

So in summary:

  • Please double-check the directory of the *.trx file, it’s $(Agent.TempDirectory)\**\*.trx is not the right report path.
  • Please double-check the file type and the coverage task. From Task Coverage and Execution, we only accept these formats:

C#

sonar.cs.vscoveragexml.reportsPaths

Path to the Visual Studio Code Coverage report. Multiple paths may be comma-delimited or included via wildcards. See Notes on importing .NET reports below.

sonar.cs.dotcover.reportsPaths

Path to dotCover coverage report. See Notes on importing .NET reports below.

sonar.cs.opencover.reportsPaths

Path to OpenCover coverage report. See Notes on importing .NET reports below.

Further references:

Regards,
Joe

1 Like