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?
I’m running into this same issue, multiple trx and coverage files still seems to produce zero coverage so I’m assuming the fix hasn’t made its way through yet?
@Jayesh_Coupland Did you succeed in merging coverage files in the end?
We are using the Sonarcloud extension for Azure DevOps which I believe is currently 1.6 and will auto update?
Will that contain the latest version of the scanner?
EDIT
Here’s the start of output from the Azure Devops task:
==============================================================================
Task : Run Code Analysis
Description : Run scanner and upload the results to the SonarCloud server.
Version : 1.6.0
Author : sonarsource
Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
==============================================================================
[command]C:\agent3_work_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.6.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.6
Using the .NET Framework version of the Scanner for MSBuild
I’m having the same issue. 2 test runs that both publish a TRX, then the SonarCloud MSBuild scanner only pics up the one that got published last. I’m running 1.6 as well.
@richardjohnston this may be be due to VSTS-179. To see if it’s this problem or a different one, please provide us the logs from the end step (to see if the coverage report is passed to the scanner).
Yes, please, open a new thread with the logs and the details of your problem.