0

I'm using SonarCloud with AzureDevops.

The sequence in my YAML file is:

  1. Restore NuGet
  2. Sonar Prepare
  3. Build solution
  4. Run tests
  5. Sonar Analyze
  6. Sonar Publish

I don't specify any output locations (at least, not knowingly).

When the tests run, I get the following output:

Test results files: d:\a_temp\TestResults\VssAdmin.....trx

But when the Sonar Analysis step executes, I get the following output:

Looking for TRX files in: d:\a\1\TestResults

So....the paths don't match.

Do I:

  • tell Azure to write the tests to a different folder?
  • or, do I tell Sonar where to find the test results?

I'm guessing the second option might be easier - in a different solution I've not yet set up, there are many test projects....

Thanks

DrGriff
  • 4,394
  • 9
  • 43
  • 92

1 Answers1

1

That's because in VSTest task, test results are stored in $(Agent.TempDirectory)/TestResults by default. You could change it to $(Common.TestResultsDirectory).

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Thanks for pointing this out. Rather than change all our build scripts just for Sonar, decided to instead hard-code the path into Sonar (`d:\a_temp\`). If it proves to be dynamic and changes over time then we'll have to back-track and change our build scripts to match Sonar. – DrGriff Jul 01 '20 at 15:13
  • So is your issue solved? If my reply helps you, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), this can be beneficial to other community members reading this thread. – Cece Dong - MSFT Jul 02 '20 at 02:28