在Azure Devops中哪里可以找到失败的VSTest的日志?

问题描述

在VNET内的Windows 2019 VM中的托管代理上运行运行Azure服务的Azure Devops管道。部署任务的最后一步是运行集成测试,但失败,并显示无用的堆栈跟踪(Microsoft调用堆栈)。

这是该步骤的YAML:

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

这是devops日志的最后一点

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.

在哪里可以找到日志以显示有关测试失败原因的更多详细信息?

解决方法

事实证明,发布管道URL变量不正确,导致测试中的http客户端失败。最终不得不添加一些测试代码以使用ITestOutputHelper记录URL,以便在测试失败的情况下我们可以轻松地查看服务URL。