从 VSTS 运行 编码 UI 测试时出错

Error while running Coded UI Test from VSTS

当我尝试从 VSTS 运行 编码 UI 测试 (Orderedtest1.orderedtest) 时,我在 VsTest 步骤中遇到以下错误:

***Error Message:
Error calling Initialization method for test class 
CodedUITestProject1.CodedUITest1: 
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run 
tests that interact with the desktop, you must set up the test agent to run 
as an interactive process. For more information, see "How to: Set Up Your 
Test Agent to Run Tests That Interact with the Desktop" 
(http://go.microsoft.com/fwlink/?LinkId=255012)
If you are running the tests as part of your team build, you must also set 
up the build agent to run as an interactive process. For more information, 
see "How to: Configure and Run Scheduled Tests After Building Your 
Application" (http://go.microsoft.com/fwlink/?LinkId=254735)
Stack Trace:
at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.Before
TestInitialize(Object sender, BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
Skipped  2- CodedUITestMethodB (OrderedTest1)***

OS(测试机):Windows 10 Pro(64 位 OS,基于 x64 的处理器) VS:Visual Studio Enterprise 2015 with Update 3

构建定义详细信息如下所示:

![enter image description here]2

我是否遗漏了以上任何步骤?请帮我解决构建失败的问题。

您正在使用 Visual Studio 测试任务,该任务使用 build/release 代理进行 运行 测试,因此您需要将 build/release 配置为交互模式,以便 运行编码UI测试,所以重新配置为交互模式。

注意:如果代理停止,您可以在命令提示符中调用run.cmd(运行命令提示符以管理员身份),您不能关闭此window否则代理将被阻止。