Handling Multiple Coverage Reports

sonarcloud
csharp
coverage
vsts

(Jayesh Coupland) #1

Hello!

I’m trying to get the right coverage data out of my .Net Core C# project. The problem seems to be that I have both unit and component tests that I run separately. Each produces a trx file and corresponding coverage data. The Sonar scanner then seems to have a problem with the multiple files and doesn’t report the coverage:

2018-08-23T07:22:42.9369196Z Post-processing started.
2018-08-23T07:22:43.1123050Z 07:22:43.111  Fetching code coverage report information from TFS...
2018-08-23T07:22:43.1142541Z 07:22:43.113  Attempting to locate a test results (.trx) file...
2018-08-23T07:22:43.1555272Z 07:22:43.154  Looking for TRX files in: D:\a\1\TestResults
2018-08-23T07:22:43.1563841Z 07:22:43.155  07:22:43.155  WARNING: More than one test result file was found: expecting to find only one. Results files: D:\a\1\TestResults\VssAdministrator_factoryvm-az243_2018- 08-23_07_22_31.trx, D:\a\1\TestResults\VssAdministrator_factoryvm-az243_2018-08-23_07_22_36.trx
2018-08-23T07:22:43.1579605Z 07:22:43.155  Attempting to locate a test results (.trx) file...
2018-08-23T07:22:43.1930718Z 07:22:43.192  Looking for TRX files in: D:\a\1\TestResults
2018-08-23T07:22:43.1931237Z 07:22:43.192  07:22:43.192  WARNING: More than one test result file was found: expecting to find only one. Results files: D:\a\1\TestResults\VssAdministrator_factoryvm-az243_2018- 08-23_07_22_31.trx, D:\a\1\TestResults\VssAdministrator_factoryvm-az243_2018-08-23_07_22_36.trx

Is there any way I can configure the Sonar Scanner to recognise both results and coverage files and to amalgamate coverage data from both?

Thanks


(Amaury Levé) #2

Hi @Jayesh_Coupland

This is currently not possible but I have created a ticket so that we handle this use case (see here).

In the meantime, the only thing you could do is to merge the different reports.


(Jayesh Coupland) #3

Ah, thanks! I’ll look into merging the reports then.