TFS2015 测试代理已中止 - PowerShell 脚本已完成但有错误

TFS2015 Test Agent Aborted - PowerShell script completed with errors

我正在 运行 构建 TFS 每晚构建,最近几天未能完成所有测试。它在几个小时后失败并显示 "Test run is aborted" 消息。在此之前,测试总是 运行 成功,并且 运行 没有对系统进行重大更改(甚至是次要更改)进行这些测试。

信息:

当我在 TFS 日志中查看最新 运行 时,它列出了以下内容 (2017-04-11T06:42:47.5500707Z):

[warning]DistributedTests: Test run is aborted. Logging details of the run logs. [warning]DistributedTests: New test run created.
[warning]Test Run queued for Project Collection Build Service
[warning]DistributedTests: Test discovery started.
[warning]DistributedTests: Test Run Discovery Completed . Test run id: 533
[warning]DistributedTests: 290 test cases discovered.
[warning]DistributedTests: Test execution started. Test run id : 533
[warning]DistributedTests: Test run timed out. Test run id : 533
[warning]DistributedTests: Test run aborted. Test run id: 533
[error]The test run was aborted, failing the task.

当我查看 运行 日志(worker_20170410-234426-utc_864.log)时,我看到:

06:42:47.659516 BaseLogger.LogConsoleMessage(scope.JobId = 7ced7f31-e360-47f3-b334-ef20faeaf000, message = ##[error]The test run was aborted, failing the task.) 06:42:47.659516 Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: PowerShell script completed with errors. at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken) at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)

test log 中,我没有在 VS 中看到任何错误,只是关于无法连接的警告(我经常看到这些):

W, 2060, 5, 2017/04/10, 16:26:03.595, XXXTESTING\QTController.exe, Test of LoadTestResultConnectString failed: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

我还看到同时在应用程序事件日志中抛出一个错误:

The description for Event ID 0 from source Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Error Handler Exception: System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).....

the message resource is present but the message is not found in the string/message table

问题是我真的不知道如何解释这些消息,每个日志都只是说 "test run was aborted, failing the task",我什至不确定 powershell 问题是什么导致的。我也不确定应用程序日志中抛出的错误是否相关,尽管它是在 运行 失败的同一时间抛出的。

当您真的不知道是什么导致测试代理失败时,研究这个问题也很困难。有与 VS, and to the TFS Test Agent, but these don't strike me as related issues, and of course there is this somewhat unhelpful post about the Powershell message.

相关的帖子

有人遇到过这种问题吗?我认为我的构建服务器在过去几天没有发生任何变化(可能是更新...),您认为什么会导致出现这样的问题?

如果您在 TFS 的 "Build" 部分中止后查看失败的构建(包含测试),它说它是 "Aborted",就是这样...如果您查看TFS "Test" 部分中构建(包含测试)的结果指定测试 运行 "Exceeded Timeout".

显然 MSTest 运行违反了此 little gem 的默认值。我认为未指定时默认为 8 小时,但我对此不太确定。无论如何,我在 "Default.testsettings" 文件中设置了以下设置:

<?xml version="1.0" encoding="utf-8"?>  
<TestSettings name="TestSettings1">
  <Execution>
    <Timeouts runTimeout="200000000" />
  </Execution>
</TestSettings>

似乎可以解决问题。测试 运行 秒成功,不再超时。