TFS 构建 运行 功能测试任务:"DistributedTests: Test run '[run#]' is in 'InProgress' state."

TFS build Run Functional Tests task: "DistributedTests: Test run '[run#]' is in 'InProgress' state."

我正在开发一个新的非 XAML TFS 版本。我的 objective 是在我们的构建代理 VM 上构建测试项目,将测试二进制文件复制到我们的测试代理 VM 并从测试代理 VM 执行我们的 Selenium web UI 测试。

我的构建定义过程如下所示:

此时,当我开始构建时,包括 Visual Studio 测试代理部署在内的所有步骤都已成功完成。

但是,当 运行 功能测试任务开始执行时,我们会看到以下控制台输出:

Preparing task execution handler.

Executing the powershell script: D:\tfsbuild-2_work_tasks\RunVisualStudioTestsusingTestAgent_d353d6a2-e361-4a8f-8d8c-123bebb71028.0.52\RunDistributedTests.ps1

DistributedTests: Environment WinRm Protocol HTTP.

DistributedTests: Creating run for selected test assemblies with following parameters

DistributedTests: SourceFilter: ***Test*.dll TestCaseFilter:

DistributedTests: Run title: [Run Title]

DistributedTests: is automated: True

DistributedTests: test settings id : [test settings id]

DistributedTests: build location: [TestProjectLocation]

DistributedTests: build id: [build id]

DistributedTests: test configuration mapping:

DistributedTests: Test Run with Id [run#] Queued

DistributedTests: Test run '[run#]' is in 'InProgress' state

运行 功能测试任务继续尝试执行直到超时,显示分布式测试:测试 运行 '[运行#]' 处于 'InProgress' 状态在 TFS 控制台输出中。

DTAExecutionHost.exe 日志文件显示每个相应控制台输出的以下条目:

DTAExecutionHost.exe Information: 0 : TestExecutionServiceCommandQueueListener.DispatchAsync : Getting Command for Test Agent 19 DateTime=2018-07-19T14:36:27.6387445Z

Web method running: [https://.../test/Agents/19/Commands/0] (GET)0[test]

Web method response: [https://.../test/Agents/19/Commands/0] (GET)0[test] 153 ms

DTAExecutionHost.exe Information: 0 : TestExecutionServiceCommandQueueListener:DispatchAsync Command Microsoft.TeamFoundation.Test.WebApi.TestExecutionServiceCommand received. DateTime=2018-07-19T14:36:27.7794911Z

DTAExecutionHost.exe Information: 0 : TestExecutionServiceCommandQueueListener.DispatchAsync : TestExecutionCommand received with None. Retrying it. DateTime=2018-07-19T14:36:27.7794911Z

DTAExecutionHost.exe Information: 0 : TestExecutionServiceCommandQueueListener.DispatchAsync : Queue not found. Delaying for 50000 milliseconds. DateTime=2018-07-19T14:36:27.7794911Z

在我的 Visual Studio 测试代理部署任务中,选择的协议是 HTTP,勾选 运行 UI 测试复选框,未勾选更新测试代理复选框。

在 Visual Studio 测试代理部署任务期间,空白 DTAExecutionHost.exe 控制台 window 在测试代理 VM 上打开;此 window 在测试 运行 尝试期间保持打开状态。

项目中的所有测试都在 Visual Studio 本地机器上按预期被发现和执行。

我最近几天阅读了很多关于这个问题的博客、帖子和讨论帖,但到目前为止还没有找到解决问题的办法。请协助;欢迎任何和所有见解和建议。

更新:2018 年 8 月 21 日

此问题仍然存在。下面提供的答案似乎解决了问题,但问题又回来了,一开始是间歇性的(我已经成功执行),现在每个构建的测试执行步骤超时。

我已取消将以下答案标记为正确。

我通过对我的设置进行一些更改来设法使它正常工作:

  1. 为我的网络 UI 测试项目创建了新的解决方案(这个项目有 成为整体更大解决方案的一部分;我一直在复制 从原始解决方案构建到测试代理 VM 的测试项目)。
  2. 向解决方案添加了 .testsettings 文件(此文件中的所有设置都保留 默认情况下,除了在 Deployment 上勾选了 Enable deployment 复选框 标签)。在我的测试项目中,在 Test -> Test Settings -> select Test 下 设置文件,我添加了新创建的.testsettings文件。

将所有更新签入 TFS 后,新构建成功完成。程序集中的所有测试都按预期被发现和执行。

在此处查看 m00nbeam360.0 的贡献:

Running Selenium functional test in TFS 2015 vNext repeats 'InProgress' and eventually times out