TFS 功能测试 运行 仅当用户登录到测试框时

TFS functional tests run only when user is logged in to test box

我正在尝试将 WPF 应用程序功能测试集成到 TFS CI 中,但这只能部分起作用。

在 TFS 构建定义中有步骤 Visual Studio Test Agent DeploymentRun Functional Tests。代理配置为 运行 作为交互式进程。只有当有人登录到测试服务器并实际看到屏幕时,一切才有效。从服务器注销后,CI 会卡在 Deploy TestAgent 步骤的任务 ConfigureTestAgent 上(请参阅下面的日志)。

代理 运行 的凭据与用于 RDP 到测试箱的凭据相同。到底是什么地方失败了 - 与 TFS 服务器或其他东西的通信?

功能测试卡在以下控制台日志中:

Starting task: Deploy TestAgent on dpp02

******************************************************************************
Executing the powershell script: c:\Agent\tasks\DeployVisualStudioTestAgent.0.25\DeployTestAgent.ps1
DistributedTests: Starting to deploy and configure test agent on test machines.
DistributedTests: Inputs provided are:
DistributedTests: Username: ts\aak
DistributedTests: Use HTTP Port: True
DistributedTests: Run as process: True
DistributedTests: Login Automatically: True
DistributedTests: Disable Screen saver: True
DistributedTests: Agent would be downloaded from http://go.microsoft.com/fwlink/?LinkId=615472
DistributedTests: Update test agent: True
DistributedTests: Run test agent as DataCollection only : False
DistributedTests: Path to script that installs test agent on remote machine: C:\Agent\tasks\DeployVisualStudioTestAgent.0.25\TestAgentInstall.ps1
DistributedTests: Path to script that configures test agent on remote machine: C:\Agent\tasks\DeployVisualStudioTestAgent.0.25\TestAgentConfiguration.ps1
DistributedTests: Path to script that downloads test agent on azure remote machines : C:\Agent\tasks\DeployVisualStudioTestAgent.0.25\DownloadTestAgent.ps1
DistributedTests: Path to script that checks if test agent is installed on remote machine: C:\Agent\tasks\DeployVisualStudioTestAgent.0.25\CheckTestAgentInstallation.ps1
DistributedTests: Path to script that checks if test agent is already running on remote machine: C:\Agent\tasks\DeployVisualStudioTestAgent.0.25\VerifyTestMachinesAreInUse.ps1
DistributedTests: Task 'VerifyTestMachinesAreInUse' on machine 'dpp02:5985' is being run
DistributedTests: Task 'VerifyTestMachinesAreInUse' on machine 'dpp02:5985' completed.
DistributedTests: Starting to download testagent
DistributedTests: testagent is downloaded at: C:\Users\aak\AppData\Local\Tempb091f9-093d-46cd-8635-3a1164d777fe
DistributedTests: Task 'CopyFilesToTestAgent' on machine 'dpp02:5985' is being run
DistributedTests: Task 'CopyFilesToTestAgent' on machine 'dpp02:5985' completed.
DistributedTests: Task 'DeployTestAgent' on machine 'dpp02:5985' is being run
DistributedTests: Task 'DeployTestAgent' on machine 'dpp02:5985' completed.
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is being run
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait
DistributedTests: Task 'ConfigureTestAgent' on machine 'dpp02:5985' is taking time. Please Wait

DTAExecutionHost.exe.log 有这个:

V, 7096, 16, 2017/08/09, 17:52:52.016, DPP02\DTAExecutionHost, TestExecutionServiceCommandQueueListener:DispatchAsync
I, 7096, 16, 2017/08/09, 17:52:52.017, DPP02\DTAExecutionHost, ExecutionTaskStateModel.ListenerCommandReceived : Requesting a stop on Stop command.
I, 7096, 16, 2017/08/09, 17:52:52.017, DPP02\DTAExecutionHost, TestExecutionServiceCommandQueueListener.DispatchAsync : Stop listening on Stop command.
I, 7096, 6, 2017/08/09, 17:52:52.017, DPP02\DTAExecutionHost, ExecutionTaskStateModel.RunStateTransitionsAsync : The task was cancelled
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removing agent setting RegisteredAgentIdOnTfs on agent machine
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removing agent setting RegisteredAgentIdOnTfs on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removed agent setting RegisteredAgentIdOnTfs on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removing agent setting RegisteredAgentIdOnTfs on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removed agent setting RegisteredAgentIdOnTfs on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removing agent setting TfsUrl on agent machine
I, 7096, 6, 2017/08/09, 17:52:52.022, DPP02\DTAExecutionHost, Removing agent setting TfsUrl on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removed agent setting TfsUrl on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting TfsUrl on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removed agent setting TfsUrl on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting DtlEnvUrl on agent machine
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting DtlEnvUrl on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removed agent setting DtlEnvUrl on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting DtlEnvUrl on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removed agent setting DtlEnvUrl on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting DtlMachineName on agent machine
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removing agent setting DtlMachineName on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.023, DPP02\DTAExecutionHost, Removed agent setting DtlMachineName on agent machine - 32 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.024, DPP02\DTAExecutionHost, Removing agent setting DtlMachineName on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.024, DPP02\DTAExecutionHost, Removed agent setting DtlMachineName on agent machine - 64 bit hive
I, 7096, 6, 2017/08/09, 17:52:52.024, DPP02\DTAExecutionHost, ExecutionHost.UnregisterFromServer : Agent is unregistering from server.
Web method running: [http://tfs01:8080/tfs/XRX%20Projects/_apis/test/Agents/33] (DELETE)33[test]
Web method response: [http://tfs01:8080/tfs/XRX%20Projects/_apis/test/Agents/33] (DELETE)33[test] 43 ms
I, 312, 1, 2017/08/09, 17:55:23.897, 24814877456, DTAExecutionHost.exe, Main.TryReadAndCacheVssCredentials Acquiring the Token Info
I, 312, 1, 2017/08/09, 17:55:23.916, 24814914498, DTAExecutionHost.exe, Communicating to the Token Servicehttp://tfs01:8080/tfs/XRX%20Projects
W, 312, 1, 2017/08/09, 17:55:23.998, 24815107475, DTAExecutionHost.exe, Service task failed. Retry attempt 10.
I, 2324, 1, 2017/08/09, 17:59:39.692, 467469870, DTAExecutionHost.exe, Main.TryReadAndCacheVssCredentials Acquiring the Token Info
I, 2324, 1, 2017/08/09, 17:59:39.723, 467537817, DTAExecutionHost.exe, Communicating to the Token Servicehttp://tfs01:8080/tfs/XRX%20Projects
I, 3240, 1, 2017/08/09, 18:02:03.753, 382139782, DTAExecutionHost.exe, Main.TryReadAndCacheVssCredentials Acquiring the Token Info
I, 3240, 1, 2017/08/09, 18:02:03.769, 382166680, DTAExecutionHost.exe, Communicating to the Token Servicehttp://tfs01:8080/tfs/XRX%20Projects
I, 1288, 1, 2017/08/09, 18:06:12.974, 462638694, DTAExecutionHost.exe, Main.TryReadAndCacheVssCredentials Acquiring the Token Info
I, 1288, 1, 2017/08/09, 18:06:12.990, 462666317, DTAExecutionHost.exe, Communicating to the Token Servicehttp://tfs01:8080/tfs/XRX%20Projects
I, 3908, 1, 2017/08/09, 18:08:09.827, 238326434, DTAExecutionHost.exe, Main.TryReadAndCacheVssCredentials Acquiring the Token Info

当机器上的组策略重置测试执行所需的自动登录注册表项时,通常会发生此问题,而部署测试代理步骤会尝试设置此注册表项。

为了测试代理 运行 交互,我们需要在盒子上有一个有效的用户会话,如果该会话不存在,则通过自动登录创建该会话。

所以,请检查您的测试机是否启用了自动登录,或者是否有任何组策略限制了自动登录。

请尝试以下操作来缩小问题范围:

  1. 如果你之前测试成功了,就试试 重新启动测试机器并取消选中“Update Test Agent” “Advanced”(默认选中并强制重新安装 TA 每次)。

  2. 如果之前没有执行过,可以尝试下载测试代理 2015,然后在那台机器上手动安装并查看结果。

如果这不起作用,请尝试:

  • 配置为服务,如果可以的话使用。
  • 请您的 IT 管理员禁用有关自动登录的域策略 用于您的测试机器。

另一方面,你可以尝试找另一台测试机测试一下是否可以很好地部署测试代理