VSTest task saves test results to wrong TestResults directory
See original GitHub issueHi all,
I’ve noticed that since a couple of weeks, Unit Tests results and Code Coverage files are no longer picked up by the SonarQube Scanner when running a build on VSTS using Hosted Agents. When I looked in the log, I saw that SonarQube can’t find any results files:
2016-10-03T09:58:06.3589980Z SonarQube Scanner for MSBuild End Step 2.1 2016-10-03T09:58:06.3589980Z 09:58:03.798 Fetching code coverage report information from TFS... 2016-10-03T09:58:06.3589980Z 09:58:03.799 Attempting to locate a test results (.trx) file... 2016-10-03T09:58:06.3599982Z 09:58:03.799 No test results files found
I found out that SonarQube is looking in the $(Common.TestResultsDirectory)
for files (e.g. c:\a\1\TestResults), while the results and coverage files are written to $(build.SourcesDirectory)\TestResults
(e.g. c:\a\1\s\TestResults). I expected them to be written to the Common.TestResultsDirectory.
It seems like the change in the VSTest task responsible for this was introduced by this commit. Line 159, which reads Common.TestResultsDirectory was deleted and replaced by this line.
$testResultsDirectory = Get-TaskVariable -Context $distributedTaskContext -Name "Common.TestResultsDirectory"
if([string]::IsNullOrEmpty($testResultsDirectory))
{
$testResultsDirectory = $workingDirectory + [System.IO.Path]::DirectorySeparatorChar + "TestResults"
}`
Could you please look into this? Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Why doesn’t vstest create the test results in $(Common.TestResultsDirectory)? I don’t understand why the same breaking consideration wasn’t considered when changing the TestResults directory.
@allendm-msft $(Common.TestResultsDirectory) is published as output/common variable at visualstudio.com: https://www.visualstudio.com/en-us/docs/build/define/variables