.
.
.
##[debug]Code coverage was enabled. Attempting to add code coverage node to settings file.
##[debug]Adding code coverage settings details to runsettings file.
##[debug]Updating runsettings file from RunSettings node
##[debug]Successfully added code coverage settings details to runsettings file.
##[debug]Code coverage node present.
.
.
.
Results File: C:\agents09\_work\_temp\TestResults\saaacount_2023-03-31_15_51_52.trx
Test Run Successful.
Total tests: 9680
Passed: 9680
Total time: 4.4753 Minutes
.
.
.
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
Data collection : Could not find data collector 'Code Coverage'
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
Data collection : Could not find data collector 'Code Coverage'
Data collection : Logging DataCollector Diagnostics in file: C:\agents09\_work\_temp\Attempt-3_bus5lc.datacollector.23-03-31_15-51-41_85644_1.diag
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
Data collection : Unable to find a datacollector with friendly name 'Code Coverage'.
Data collection : Could not find data collector 'Code Coverage'
.
.
.
.
SonarQube/SonarCloud does not run tests or generate reports, but imports pre-generated reports from another source. So, the first thing to do is check that the coverage reports are being generated correctly by the Microsoft tooling.
Which step in the build pipeline is producing the Data collection: Unable to find a datacollector... message?
My guess is that is the VSTest step, in which case the problem is probably to do with the set up of your build agent or build pipeline. You’re using the standard VSTest task, so the configuration in the pipeline should be correct. You’re using a self-hosted agent, so I suggest you confirm that the coverage tools are installed on the agent.
Change file extension from .nupkg to .zip. File name should be microsoft.testplatform.17.5.0.zip.
Unzip the file contents in new folder C:\tools\
Add path of code coverage to the path environmental variable. It should be “C:\tools\microsoft.testplatform.17.5.0\tools\net462\Team Tools\Dynamic Code Coverage Tools”
This way I can call codecoverage and convert the .coverage file to .coveragexml.
Added task to install Test platform version 17.5.0
Added these properties to SQ prepare: sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)\**\*.trx