VSTEST code coverage not being picked up

Hi @Andres_D

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.

If the test coverage report is being produced, then have a look at our Troubleshooting .NET code coverage import guide.