无法使用带有 VS 207 Enterprise 的 TFS 2017 在远程 VM 上执行编码 UI 测试(无法加载文件或程序集)

Unable to execute Coded UI Tests on remote VM using TFS 2017 with VS 207 Enterprise (Could not load file or assembly)

我已经在我的构建服务器和测试服务器上安装了 VS 2017 Enterprise,并安装了编码 UI 测试组件,但我的 "Run Functional Tests" TF 构建任务仍然无法解析对编码UITestFramework 程序集。所有程序集都存在于 "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies" 文件夹中的两个 VM 上。

我已经尝试了以下没有用的方法!

1) 添加了 PublicAssemblies 文件夹 PATH 环境变量

2) 将程序集添加到 GAC

这是 运行 TF Build/Release 进程时控制台中显示的错误:

MSTestAdapter 未能在程序集 'c:\Test\CodedUITestProject1.dll' 的 class 'CodedUITestProject1.CodedUITest1' 中发现测试。原因无法加载文件或程序集 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。系统找不到指定的文件..

我不知道如何启用我的测试 DLL 来解析此程序集引用?

为了 运行 编码 UI 测试,您必须将测试代理配置为 与桌面交互 并构建代理 运行ning作为交互模式。

首先请确保您已在Visual Studio测试代理部署任务的代理配置中启用它。

除了获取更多故障排除信息外,您还可以 enable debug mode 在构建定义中。


更新

  • TFS 2017 RTM – TFS 2017 RTM shipped with ‘Visual Studio Test Agent Deployment’ (v1) and ‘Run Functional Tests’ tasks that can be used in the Team Build / Release Management scenarios. These tasks use the Agents for Visual Studio 2015 Update 3 package. As such, the tasks in their current form can be used for running tests built using Visual Studio 2015 and Visual Studio 2013. They cannot run tests built using Visual Studio 2017.

  • TFS 2017 Update 1 – TFS 2017 Update 1 shipped with ‘Visual Studio Test Agent Deployment’ (v2) and ‘Run Functional Tests’ tasks that can be used in the Team Build / Release Management scenarios. The test agent deployment task has the ability to specify which Agent version (2015 or 2017) should be deployed. Based on the selection, the appropriate agent will get deployed and can run tests built using Visual Studio versions as described in the previous sections.

来源Link:Test Controller, Test Agent versions and their usage in different scenarios

事实证明解决方案非常简单。在我不知道的每个任务的右上角都有一个 "Version" 下拉菜单。 :( 我需要使用 VS Test Agent Deployment 任务的 "Version 2",以便我可以正确配置它以部署 VS 2017 Test Agent。一旦到位,部署和 运行 测试任务 运行 立即没有错误!再次感谢@Patrick-MSFT 一路上的输入!