1

I am facing issues to get code coverage report via sonar cloud in my angular project.

I have configured karma tool to get the test report. Output file is generating test report in .xml format. I configured the test report path in sonar as well:

sonar.cs.vscoveragexml.reportsPaths=$(Agent.BuildDirectory)/TestResults/*.xml

But sonar cloud is searching for .trx extension test report.Below is the error log.

06:16:44.724  Looking for TRX files in: D:\a\1\TestResults
06:16:44.724  No test results files found
06:16:45.083  Did not find any binary coverage files in the expected location.
06:16:45.083  Falling back on locating coverage files in the agent temp directory.
06:16:45.083  Searching for coverage files in D:\a\_temp

Requesting to help me to resolve the same.

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
sam
  • 19
  • 1
  • Does your issue solved now? Does the test result file could be found successfully now? Feel free to let us know the latest status. – Mengdi Liang Jul 11 '19 at 06:49

2 Answers2

1

By default, if you not specified other file path, the TRX file is exist under s file, it's file path is under $(System.DefaultWorkingDirectory), not $(Agent.BuildDirectory).

enter image description here

According to the error message:

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

D:\a\1\TestResults, this is the incorrect file path which is the TRX file exist by default.

So, if you did not specified another file path in VSTest, the .TRX file path should be reading as D:\a\1\s\TestResults which is under $(build.SourcesDirectory) instead of $(Agent.BuildDirectory) .

Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35
0

You can add a copy tasks like this to transfer what is generated on test to what is the path Sonarqube is looking.

enter image description here

Crismogram
  • 906
  • 15
  • 27