首页 > 解决方案 > 在哪里可以找到 Azure Devops 中失败的 VSTest 的日志?

问题描述

在 VNET 内的 Windows 2019 VM 中的托管代理上运行用于应用服务部署的 Azure Devops 管道。部署任务的最后一步是运行集成测试,但它因堆栈跟踪(microsoft callstack)而失败。

这是该步骤的 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.

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

标签: azure-devopsxunitvstest

解决方案


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


推荐阅读