Search code examples
azure-devopsxunitvstest

Where to find logs for failed VSTest in Azure Devops?


Have an Azure Devops pipeline for app service deployment running on hosted agent in Windows 2019 VM inside of a VNET. Last step of of deployment tasks is to run integration tests but its failing with unhelpful stack trace (microsoft callstack).

Here is the YAML for that step:

steps:
- task: VSTest@2
  displayName: 'Run Integration Tests'
  inputs:
    testAssemblyVer2: '$(System.DefaultWorkingDirectory)/_FooService pipeline/drop/output/FooServiceTests.Integration.dll'

Here is last bit of devops logs

2020-09-25T01:00:48.0902607Z --- End of stack trace from previous location where exception was thrown ---
2020-09-25T01:00:48.0903591Z    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-09-25T01:00:48.0904073Z    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-09-25T01:00:48.0904563Z    at Microsoft.VisualStudio.Services.WebApi.TaskExtensions.SyncResult[T](Task`1 task)
2020-09-25T01:00:48.0905027Z    at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClient[T]()
2020-09-25T01:00:48.0905523Z    at Microsoft.VisualStudio.TestService.RestApiHelpers.TcmTestExecutionServiceRestApiHelper..ctor(String project)
2020-09-25T01:00:48.0906060Z    at MS.VS.TestService.VstestConsoleAdapter.VstestConsoleRunContext.InitializeRestApiHelper()
2020-09-25T01:00:48.0906556Z    at MS.VS.TestService.VstestConsoleAdapter.VstestConsoleRunContext.CreateRunContext()
2020-09-25T01:00:48.0907032Z    at MS.VS.TestService.VstestConsoleAdapter.VstestConsoleRunContext.get_Instance()
2020-09-25T01:00:48.0907540Z    at Microsoft.VisualStudio.TestService.AgentExecutionHost.LocalTestRunHost.Execute(Boolean debugLogs)
2020-09-25T01:00:48.0908043Z    at Microsoft.VisualStudio.TestService.AgentExecutionHost.Program.Main(String[] args)
2020-09-25T01:00:48.1629868Z ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
2020-09-25T01:00:48.1631712Z ##[error]Error: The process 'C:\Users\TestAdmin\agent\_work\_tasks\VSTest_ed087383-ee5e-42c7-8a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 3762504530
2020-09-25T01:00:48.1634275Z ##[error]Vstest failed with error. Check logs for failures. There might be failed tests.

Where can I find the logs to show more detail as to why the test is failing?


Solution

  • Turns out that a release pipeline URL variable was incorrect which caused the http client in a test to fail. Ended up having to add some test code to use ITestOutputHelper to log the URL so we can easily see the service url in the event of test failure.