Azure DevOps (VSTS) extension no longer import coverage and unit tests automatically

sonarcloud
vsts

(Daniel Svensson) #1

Template for a good bug report, formatted with Markdown:

  • versions used: latest sonarcloud 1.5.1

  • error observed (wrap logs/code around triple quote ``` for proper formatting)

    the plugin looks for trx file under the “wrong” path (a different path than what is actually used).

I would expect the plugin to continue to check for trx file in the same (which seems “correct” according to docs) path but also under “agent temp” directory where the trx and coverage file seems to be saved currently.
it seems the VSTS team recently change test output directory se: https://github.com/Microsoft/azure-pipelines-tasks/issues/7975

2019-01-02T21:51:11.2305659Z 21:51:11.229  Fetching code coverage report information from TFS...
2019-01-02T21:51:11.2321799Z 21:51:11.231  Attempting to locate a test results (.trx) file...
2019-01-02T21:51:11.2919665Z 21:51:11.291  Looking for TRX files in: D:\a\1\TestResults
2019-01-02T21:51:11.2923403Z 21:51:11.291  No test results files found
  • steps to reproduce

setup an azuire pipelines (YAML) build of https://github.com/OpenRIAServices/OpenRiaServices and run it


(Fabrice Bellingard) #2

I’ve just run a build on one of my projects, and the test and coverage results seem to be correctly found:

2019-01-09T14:07:33.9623117Z 14:07:33.663  Fetching code coverage report information from TFS...
2019-01-09T14:07:33.9623193Z 14:07:33.665  Attempting to locate a test results (.trx) file...
2019-01-09T14:07:33.9623430Z 14:07:33.671  Looking for TRX files in: D:\a\1\TestResults, D:\a\1\s\TestResults
2019-01-09T14:07:33.9623520Z 14:07:33.671  The following test results files were found: D:\a\1\s\TestResults\VssAdministrator_fv-az24 2019-01-09 14_07_26.trx
2019-01-09T14:07:33.9623609Z 14:07:33.683  The following code coverage attachments were found from the trx files: D:\a\1\s\TestResults\VssAdministrator_fv-az24 2019-01-09 14_07_26\In\fv-az24\VssAdministrator_fv-az24 2019-01-09 14_06_54.coverage

, and therefore correctly reported in SonarCloud (see the results for my Sample .NET Project).

Can this come from missing or incorrect configuration of one of the tasks?


(Daniel Svensson) #3

What version of the vstest task is you using, as you can se in the repo I provided I have been using v2 and the hosted (vs 2015) build image.

If you also look at the Microsoft github issue this is a (recent)known change to newer agents and it seems they don’t want users to use the test result directly


(Daniel Svensson) #4

I’ve tried to change the vstest task back to v1 and then it works, but v2 does not work (which I currently “need” in order to solve some flaky tests).

If you work at sonarsource I highly recommend you to visit the github issue at microsoft repository (my first link) since at least some developer over there seems to have a goal of not having any build results accessible to other tasks (except by maybe downloading them from artifact)


(Sean Mackey) #5

Daniel, Will you please link that github post you found.

Sonar team, is there a recommendation to get coverage from vstest task?


(Fabrice Bellingard) #6

@Ammo I think this is the same topic as When am running SonarCloud integration with VSTS in Code Coverage section it is showing 0.0%,please help me how to get the report and I think that a ticket should be created to fix this.