当我尝试使用Team Foundation Server 2015(更新4)运行一个简单的Coded UI测试项目(使用一个测试方法验证"添加" Windows计算器应用程序的功能)时,I& #39;在测试执行步骤中出现以下错误 -
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.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
设置/环境详细信息: 操作系统:Windows Server 2012 Standard(64位操作系统,基于x64的处理器) VS:使用Update 3的Visual Studio Enterprise 2015 TFS:Team Foundation Server 2015 with Update 4
构建定义(构建步骤)[NOT XAML定义]:
运行使用的设置文件:
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="TestSettings1" id="bd8c898e-4b22-407c-bc02-0861123a1dbd" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Execution>
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
<Browser name="Internet Explorer 9.0" MaxConnections="6">
<Headers>
<Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
</Headers>
</Browser>
</WebTestRunConfiguration>
</TestTypeSpecific>
<AgentRule name="LocalMachineDefaultRole">
</AgentRule>
</Execution>
<Properties>
<Property name="TestSettingsUIType" value="UnitTest" />
</Properties>
</TestSettings>
我是否错过了上述任何步骤?请帮我解决构建失败问题。
提前致谢!
此致
阿燕
答案 0 :(得分:1)
您使用的是错误的任务。您需要使用Run Functional Tests而不是Visual Studio Test。
典型方案包括:
- 需要在测试计算机上进行其他安装的测试,例如Selenium测试的不同浏览器
- 编码的UI测试
- 需要特定操作系统配置的测试
- 使用多台测试机器更快地执行大量单元测试
有关该任务的更多信息,请参阅此博客:Running Automated Test on agent machine using vNext Build
除了运行Coded UI测试之外,您还必须将测试代理配置为交互,以及作为交互模式运行的桌面和构建代理。