When am running SonarCloud integration with VSTS in Code Coverage section it is showing 0.0%,please help me how to get the report


if you look at the analyse log, deos it detect and upload the coverage? otherwise this might be related to https://github.com/Microsoft/azure-pipelines-tasks/issues/7975

Hi @Daniel-Svensson,

Have you followed the instructions on this page: https://docs.sonarqube.org/x/CoBh

The logs will tell you if any coverage report was found.


My comment was about the VSTS (azure devops / pipelines) plugin (https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Extension+for+VSTS-TFS).

The setup steps are a bit different that the link you mention since that tells you how to execute everything from the command (which by the way works fine).

The extension is (was) great since it automatically find and import unit test and coverage files using the “.trx” fil. The issue is that the vstest step has changed so that they save the file somewhere where the plugin does not look (even if you change the trx search path)

Hey @Daniel-Svensson

I have the same issue here. I am using the build steps recommended on the documentation and it works fine but the code coverage is always 0%. I can see on the log that the .trx file was generated but as you said, even changing the way of how to speficy the path of the file it does not work.

Is there any way (or workaround) to get it working?

Thank you.

1 Like

Use vstest v1 task instead of v2 to get it working
. See Azure DevOps (VSTS) extension no longer import coverage and unit tests automatically

Hi @Daniel-Svensson, yes, I am using the v1 but there is no results yet. In the logs I can see the .trx file was generated and when I access my build server I can see the file on the disk, but, the code coverage on sonarQube is still 0% even all testing running and passing during the build. I have defined on the Prepare analysis on SonarQube the argument:


On the vstest build step I checked the Code Coverage Enabled. See the configs.
What am I doing wrong?

Does Visual Studio Community installed on the machine affects it or it does not matter?

Please help me :smiley:.
Thank you.


This thread duplicates Azure DevOps (VSTS) extension no longer import coverage and unit tests automatically.

I’m closing it.

1 Like