构建后在本地执行 CodedUITests 时出现 FileNotFoundException

FileNotFoundException when executing CodedUITests locally after build

我是 VS2013 和 C# 的新手。我试图用 VS CodedUITests 和 WebTests 测试网页的 UI。这已成功完成。当我手动 运行 时,我的测试工作正常。

当我想自动执行此过程时,问题就来了。我不想使用测试代理(我需要第二台机器),而是想在成功构建后立即创建构建和 运行 这些测试。我创建了构建并且它工作正常(我得到 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>

构建服务器上必须有相同版本的Visual Studio。在这种情况下,我正在编译和 运行 编码 UI 测试,所以我至少需要 Visual Studio Premium.