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

时间:2018-03-03 15:36:17

标签: visual-studio-2015 azure-devops coded-ui-tests

当我尝试从VSTS运行Coded UI Test(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位操作系统,基于x64的处理器) VS:使用Update 3的Visual Studio Enterprise 2015

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

  

enter image description here ![enter image description here] 2 enter image description here

我是否错过了上述任何步骤?请帮我解决构建失败问题。

1 个答案:

答案 0 :(得分:2)

您正在使用Visual Studio Test任务,它使用构建/发布代理来运行测试,因此您需要将构建/发布配置为交互模式才能运行Coded UI测试,因此将其重新配置为交互模式。

enter image description here

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