TFS2017 中硒测试的问题 运行 'Deploy TestAgent' 步骤

Issues running 'Deploy TestAgent' step for selenium tests in TFS2017

我正在尝试使用 'Deploy TestAgent' 步骤作为构建的一部分,这样我就可以 运行 Selenium 测试。不幸的是,我一直 运行ning 出现以下错误...

2017-05-05T16:31:13.9263760Z ##[warning]DistributedTests: Task 'ConfigureTestAgent' for machine DESKTOP-K88UM6R:5985's Error : System.Exception: Unable to find TestAgent installation path

完整日志文件如下...

2017-05-05T16:30:46.3449184Z ##[section]Starting: Deploy TestAgent on DESKTOP-K88UM6R
2017-05-05T16:30:46.3449184Z ==============================================================================
2017-05-05T16:30:46.3449184Z Task         : Visual Studio Test Agent Deployment
2017-05-05T16:30:46.3449184Z Description  : Deploy and configure Test Agent to run tests on a set of machines
2017-05-05T16:30:46.3449184Z Version      : 1.0.42
2017-05-05T16:30:46.3449184Z Author       : Microsoft Corporation
2017-05-05T16:30:46.3449184Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=625976)
2017-05-05T16:30:46.3449184Z ==============================================================================
2017-05-05T16:30:46.3605675Z Preparing task execution handler.
2017-05-05T16:30:46.8620069Z Executing the powershell script: C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\DeployTestAgent.ps1
2017-05-05T16:30:48.0116105Z DistributedTests: Starting to deploy and configure test agent on test machines.
2017-05-05T16:30:48.0297456Z DistributedTests: Inputs provided are:
2017-05-05T16:30:48.0297456Z DistributedTests: Username: DESKTOP-K88UM6R\matty
2017-05-05T16:30:48.0302506Z DistributedTests: Use HTTP Port: True
2017-05-05T16:30:48.0302506Z DistributedTests: Run as process: True
2017-05-05T16:30:48.0307486Z DistributedTests: Login Automatically: True
2017-05-05T16:30:48.0307486Z DistributedTests: Disable Screen saver: True
2017-05-05T16:30:48.0312658Z DistributedTests: Agent would be downloaded from https://go.microsoft.com/fwlink/?LinkId=615472
2017-05-05T16:30:48.0312658Z DistributedTests: Update test agent: True
2017-05-05T16:30:48.0312658Z DistributedTests: Run test agent as DataCollection only : False
2017-05-05T16:30:48.0317489Z DistributedTests: Path to script that installs test agent on remote machine: C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\TestAgentInstall.ps1
2017-05-05T16:30:48.0317489Z DistributedTests: Path to script that configures test agent on remote machine: C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\TestAgentConfiguration.ps1
2017-05-05T16:30:48.0317489Z DistributedTests: Path to script that downloads test agent on Azure remote machines : C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\DownloadTestAgent.ps1
2017-05-05T16:30:48.0322465Z DistributedTests: Path to script that checks if test agent is installed on remote machine: C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\CheckTestAgentInstallation.ps1
2017-05-05T16:30:48.0322465Z DistributedTests: Path to script that checks if test agent is already running on remote machine: C:\Build Agent\TFS\Builds\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6.0.42\VerifyTestMachinesAreInUse.ps1
2017-05-05T16:30:48.0322465Z DistributedTests: Path to script that helps to download and configure test agent : 
2017-05-05T16:30:48.1305296Z DistributedTests: Task 'PopulatingMachinesPresentState' on machine 'DESKTOP-K88UM6R:5985' is being run
2017-05-05T16:30:52.1708691Z DistributedTests: Task 'PopulatingMachinesPresentState' on machine 'DESKTOP-K88UM6R:5985' completed.
2017-05-05T16:30:52.1865084Z DistributedTests: Starting to download testagent
2017-05-05T16:31:04.3843950Z DistributedTests: testagent is downloaded at: C:\Users\matty\AppData\Local\Tempff37613-bc34-4f69-afb1-7128d841678f
2017-05-05T16:31:04.7161264Z DistributedTests: Task 'CopyFilesToTestAgent' on machine 'DESKTOP-K88UM6R:5985' is being run
2017-05-05T16:31:06.1901171Z DistributedTests: Task 'CopyFilesToTestAgent' on machine 'DESKTOP-K88UM6R:5985' completed.
2017-05-05T16:31:06.1901171Z DistributedTests: Task 'DeployTestAgent' on machine 'DESKTOP-K88UM6R:5985' is being run
2017-05-05T16:31:09.9855530Z DistributedTests: Task 'DeployTestAgent' on machine 'DESKTOP-K88UM6R:5985' completed.
2017-05-05T16:31:10.0011806Z DistributedTests: Task 'ConfigureTestAgent' on machine 'DESKTOP-K88UM6R:5985' is being run
2017-05-05T16:31:13.9263760Z DistributedTests: Task 'ConfigureTestAgent' on machine 'DESKTOP-K88UM6R:5985' completed.
2017-05-05T16:31:13.9263760Z ##[warning]DistributedTests: Task 'ConfigureTestAgent' for machine DESKTOP-K88UM6R:5985's Error : System.Exception: Unable to find TestAgent installation path
2017-05-05T16:31:13.9263760Z ##[warning]DistributedTests: Task 'ConfigureTestAgent' for machine DESKTOP-K88UM6R:5985's Log : 
2017-05-05T16:31:13.9263760Z     Deployment started on target machine...
2017-05-05T16:31:13.9263760Z 
2017-05-05T16:31:13.9263760Z System.AggregateException: Failed to execute the powershell script. Consult the logs below for details of the error.
2017-05-05T16:31:13.9263760Z Unable to find TestAgent installation path ---> System.Management.Automation.RuntimeException: Unable to find TestAgent installation path ---> System.Management.Automation.RuntimeException: Unable to find TestAgent installation path
2017-05-05T16:31:13.9263760Z    --- End of inner exception stack trace ---
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-05-05T16:31:13.9263760Z    at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
2017-05-05T16:31:13.9263760Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.<>c__DisplayClass28_0.<Invoke>b__0()
2017-05-05T16:31:13.9263760Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.<>c__DisplayClass19_0`1.<Execute>b__0()
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute[T](Func`1 action)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)
2017-05-05T16:31:13.9419999Z    --- End of inner exception stack trace ---
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.ScriptExecutor.ExecuteScript(IPowerShell powerShell, String script, String arguments, Boolean isScriptDotSourced, Boolean useHttp)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.DeploymentService.RunPowerShellScripts(DeploymentMachineSpecification deploymentMachine, ScriptSpecification scriptSpecification, ScriptSpecification initializationScriptSpecification, String applicationPath, IPowerShell powerShellSession)
2017-05-05T16:31:13.9419999Z ---> (Inner Exception #0) System.Management.Automation.RuntimeException: Unable to find TestAgent installation path ---> System.Management.Automation.RuntimeException: Unable to find TestAgent installation path
2017-05-05T16:31:13.9419999Z    --- End of inner exception stack trace ---
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-05-05T16:31:13.9419999Z    at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.<>c__DisplayClass28_0.<Invoke>b__0()
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.<>c__DisplayClass19_0`1.<Execute>b__0()
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute[T](Func`1 action)
2017-05-05T16:31:13.9419999Z    at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)<---
2017-05-05T16:31:13.9419999Z Finding whether TestAgent configuration is required
2017-05-05T16:31:13.9419999Z 
2017-05-05T16:31:13.9419999Z Getting existing configuration
2017-05-05T16:31:13.9419999Z 
2017-05-05T16:31:13.9419999Z 
2017-05-05T16:31:13.9419999Z ##[error]Error occured on 'DESKTOP-K88UM6R:5985'. Details : 'Unable to find TestAgent installation path'. For troubleshooting, refer https://aka.ms/remotevstest.
2017-05-05T16:31:13.9419999Z ##[error]System.Exception: Error occured on 'DESKTOP-K88UM6R:5985'. Details : 'Unable to find TestAgent installation path'. For troubleshooting, refer https://aka.ms/remotevstest.
2017-05-05T16:31:13.9732454Z ##[warning]For troubleshooting, refer https://aka.ms/remotevstest.
2017-05-05T16:31:13.9732454Z ##[error]System.InvalidOperationException: Deploy Test Agent task has failed on all machines. Check the logs for more details.
2017-05-05T16:31:13.9732454Z    at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.DeployTestAgent.Run()
2017-05-05T16:31:13.9732454Z    at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.TaskRunner.Run(Dictionary`2 arguments, VssConnection connection, TaskType taskType)
2017-05-05T16:31:13.9732454Z    at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.InvokeDeployTestAgentCmdlet.ProcessRecord()
2017-05-05T16:31:14.0266415Z ##[error]PowerShell script completed with 2 errors.
2017-05-05T16:31:14.0266415Z ##[section]Finishing: Deploy TestAgent on DESKTOP-K88UM6R

我可以在构建期间看到 vstf_testagent 文件出现在我的 Temp 文件夹中,但我不明白为什么它会抱怨安装路径。

这里有更多信息

非常感谢

Visual Studio 测试代理部署任务中的测试代理位置

Optional. The path to the test agent (vstf_testagent.exe) if different from the default path.

  • If you use a copy of the test agent located on your local computer or network, specify the path to that instance.

  • The location must be accessible by either the build agent (using the identity it is running under) or the test agent (using the identity configured above).

根据 Unable to find TestAgent installation path 错误。您可以先手动下载代理,而不是从 Internet 下载代理。然后将 VS 201x 测试代理放在 share 文件夹中,并让 VS 测试代理部署任务部署它。 (不要在本地安装代理)

此外,如果您使用的是测试代理 2017。您需要先将 TFS2017 更新为 TFS2017 update1。每个任务的右上角都有一个“版本”下拉菜单。您需要使用 VS 测试代理部署任务的 "Version 2",以便您可以正确配置它以部署 VS 2017 测试代理。