我是VS2013和C#的新手。我试图用VS CodedUITests和WebTests测试网页的UI。这已成功完成。我手动运行它时,我的测试工作正常。
当我想要自动执行此过程时,问题就出现了。而不是使用测试代理(我需要第二台机器),我想创建一个Build并在成功构建后立即运行这些测试。我创建了构建并且它工作正常(我得到Build partially succeeded
),但测试没有运行,因为不知何故(即使在成功构建之后)它找不到UITesting
报告此错误:
Run MSTest for Test Assemblies
+ d:\a\bin\CodedUITestProject1.dll
+ Unable to load the test container 'd:\a\bin\CodedUITestProject1.dll
or one of its dependencies. Error details: System.IO.FileNotFoundException:
Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting,
Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
of its dependencies. The system cannot find the file specified.
我在任何地方都没有这个d:\a\bin
路径,所以我认为它是构建的临时路径。我不确定我在做什么是可能的。我想要的只是构建我的项目并运行这些UI / Web测试,但也许这不是正确的方法。对此有何帮助?
这是项目的Local.testsettings
:
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Local" id="38e7b5f5-3e94-4739-a620-dfb4ddfa9c35" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Deployment>
<DeploymentItem filename="..\CodedUITestProject1\" />
</Deployment>
<Execution>
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207" runUntilDataExhausted="true">
<Browser name="Internet Explorer 10.0" MaxConnections="6">
<Headers>
<Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.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 :(得分:0)
必须在Build Server上安装相同版本的Visual Studio。在这种情况下,我正在编译和运行Coded UI Tests,所以我至少需要 Visual Studio Premium 。