New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRX file cannot be correctly located in VsTest 16.7 in Azure DevOps Pipeline #13404
Comments
@aDisplayName Are you able to access this result file |
@aDisplayName I tested using VsTest 16.7.0 with specifying So, in your case trx file was saved to And this @aDisplayName Could you also provide runsettings file? |
Thanks @Sanan07
Yes, the trx, coverage, and the raw data were all under C:\agent_work\31 folder.
The only runsettings was the one generated by VsTest task. I've attached the full log here. Also, the azure agent version is 2.165.0 |
@Sanan07 , I agree with you. It seems VsConsole.exe did complete with exit code 0. And indeed it was the DTAExecutionHost.exe which exited with error code 1:
|
@aDisplayName Please look at this #11526 and https://developercommunity.visualstudio.com/content/problem/756960/21574modulesdtaexecutionhostexe-failed-with-exit-c.html |
@Sanan07 But the only thing between pass and fail is the change from VsTest 16.6.1 to 16.7.0. Actually I tried with 16.6.1 today after we had problem with 16.7.0, and the tasks passed without any glitch. Back to 16.7.0, failed again. Same build agent. |
@aDisplayName Could you please provide installation logs for VsTest 16.6.1 as you provided in your post for 16.7.0? As you may see above 16.7.0 was installed inside
|
@Sanan07 as far as I know, every azure task is using |
@Sanan07, I am able to reproduce the problem with the following azure pipeline scripts. Using vstest 16.6.1When using vstest 16.6.1, all task completed without problem trigger: none
pool:
vmImage: 'windows-latest'
workspace:
clean: all
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.1.302'
inputs:
version: 3.1.302
- powershell: |
Set-Location $(System.DefaultWorkingDirectory)
dotnet new mstest -o MyApp.UnitTest
dotnet build MyApp.UnitTest/MyApp.UnitTest.csproj -o output
- task: VisualStudioTestPlatformInstaller@1
displayName: 'VsTest Platform Installer'
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'specificVersion'
testPlatformVersion: '16.6.1'
- task: VSTest@2
displayName: 'VsTest - testAssemblies - .Net Framework'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**/MyApp.UnitTest.dll
searchFolder: '$(System.DefaultWorkingDirectory)/output'
vsTestVersion: 'toolsInstaller'
codeCoverageEnabled: true
pathtoCustomTestAdapters: '$(System.DefaultWorkingDirectory)/output'
otherConsoleOptions: '/ResultsDirectory:$(Common.TestResultsDirectory)'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Common.TestResultsDirectory)/**/*.trx' Using vstest 16.7.0When using vstest 16.7.0, the vstest task failed when publishing the test result. trigger: none
pool:
vmImage: 'windows-latest'
workspace:
clean: all
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.1.302'
inputs:
version: 3.1.302
- powershell: |
Set-Location $(System.DefaultWorkingDirectory)
dotnet new mstest -o MyApp.UnitTest
dotnet build MyApp.UnitTest/MyApp.UnitTest.csproj -o output
- task: VisualStudioTestPlatformInstaller@1
displayName: 'VsTest Platform Installer'
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'specificVersion'
testPlatformVersion: '16.7.0'
# To avoid vstest execution error, we need to split tests into group by framework version.
- task: VSTest@2
displayName: 'VsTest - testAssemblies - .Net Framework'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**/MyApp.UnitTest.dll
searchFolder: '$(System.DefaultWorkingDirectory)/output'
vsTestVersion: 'toolsInstaller'
codeCoverageEnabled: true
pathtoCustomTestAdapters: '$(System.DefaultWorkingDirectory)/output'
otherConsoleOptions: '/ResultsDirectory:$(Common.TestResultsDirectory)'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Common.TestResultsDirectory)/**/*.trx' Here is the build agent information
|
@aDisplayName Could you run the agent with v16.7 but without this property As from logs, again it looks like vstest completed successfully, but issue occurs when AzDo trying got fetch trx log file. |
@Sanan07 The answer is "Yes" that removing the The long story of why we have to use
That is the reason why we have to have |
@aDisplayName are you using AzureDevOps onprem or AzureDevOps hosted service? |
@ShreyasRmsft Azure DevOps hosted service. Sprint 172 |
@aDisplayName you'd need to use the dedicated input of results folder input field instead of providing it in the otherconsoleoptions input since we do not parse/validate otherconsole options as it is an open ended field and just pass it on to vstest.console.exe. |
@Sanan07 , Will it be possible to tell why the change of VsTest version caused the behavior change in pipeline task? @ShreyasRmsft Sorry, but your solution doesn't work for us. Consider the following script, only the second vstest result is available for "Publish Test Results" task. Apparently the first vstest result was cleared up by As I've mentioned earlier, our "SonarQube" code analysis task needs test results from all vstest tasks to be available. trigger: none
pool:
vmImage: 'windows-latest'
workspace:
clean: all
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.1.302'
inputs:
version: 3.1.302
- powershell: |
Set-Location $(System.DefaultWorkingDirectory)
dotnet new mstest -o MyApp.UnitTest
dotnet build MyApp.UnitTest/MyApp.UnitTest.csproj -o output
Write-Host hello
Write-Host $(Common.TestResultsDirectory)
- task: VisualStudioTestPlatformInstaller@1
displayName: 'VsTest Platform Installer'
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'latestStable'
# To avoid vstest execution error, we need to split tests into group by framework version.
- task: VSTest@2
displayName: 'VsTest - testAssemblies - .Net Framework'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '**/MyApp.UnitTest.dll'
searchFolder: '$(System.DefaultWorkingDirectory)/output'
resultsFolder: '$(Common.TestResultsDirectory)'
vsTestVersion: 'toolsInstaller'
pathtoCustomTestAdapters: '$(System.DefaultWorkingDirectory)/output'
codeCoverageEnabled: true
- task: VSTest@2
displayName: 'VsTest - testAssemblies - .Net Framework'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '**/MyApp.UnitTest.dll'
searchFolder: '$(System.DefaultWorkingDirectory)/output'
resultsFolder: '$(Common.TestResultsDirectory)'
vsTestVersion: 'toolsInstaller'
pathtoCustomTestAdapters: '$(System.DefaultWorkingDirectory)/output'
codeCoverageEnabled: true
- powershell: |
Get-ChildItem $(Common.TestResultsDirectory)/*.trx -Recurse | Write-Host
Get-ChildItem $(Common.TestResultsDirectory)/*.trx -Recurse | Measure-Object
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Common.TestResultsDirectory)/**/*.trx' |
@aDisplayName Couple of points, the vstest task itself publishes the testresults for you. By adding another publish you are creating duplicate test runs/results on the server that will show up in the tests UI. Today the vstest task instance always cleans up the test results folder at the beginning of a run to avoid conflicts. You can specify |
@ShreyasRmsft @Sanan07 Thanks. It is clear to me now. The conclusion is that there is a behavior changes from VsTest 16.6.1 to 16.7.0 that regarding test result publishing when running within VsTest Azure Pipeline Task. Regards |
Our CI pipeline just started to fail with Excerpts from the log:
More setup:
After test execution:
@ShreyasRmsft how can we restore our ability to run tests? |
I am having a similar problem, but it only impacts the "release,x86" test run. For people with MS corp net access here is the log showing the failure. |
FYI our issue turned out to be a deadlocked test. After an hour, the test runner process was ended without producing the .trx file. What we really need here is
|
@AmadeusW thank you. in my case I had a buggy test that resulted in calling |
Description
Starting today, the VsTest 16.7.0 is available in Azure DevOps pipeline. We got an error message at the end of the VsTest step that it clamied TRX was not found when publishing the test.
It appears the VsTest was looking for trx file in
\agent\_work\_temp\TestResults
while it was actually saved to$(Common.TestResultsDirectory)
We were using VsTest 16.6.1 with the same pipeline this past Sunday without problem.
Script
Here is the part of our yml pipeline file:
Log
Here is the log output:
Here is the log output for VsTest 16.7.0 installation
We were using VsTest 16.6.1 without problem before today.
Environment
The agent is running at Windows 10 1803
The text was updated successfully, but these errors were encountered: