单元测试适配器引发异常:无法加载一个或多个请求的类型。带有测试管理器的CodedUI

时间:2016-03-17 12:28:41

标签: c# testing visual-studio-2015 automated-tests coded-ui-tests

当我尝试从Microsoft Test Manager 2015运行CodedUI测试时,我得到错误:

“单元测试适配器引发异常:无法加载一个或多个请求的类型”

enter image description here

从VS2013切换到VS2015后,我开始遇到此问题。 试图通过改变测试适配器来解决这个问题,但它没有用。

1 个答案:

答案 0 :(得分:0)

升级到VS2015时,对CodedUI库的引用已更新为最新版本。您可能正在运行2013年无法加载新程序集的测试代理程序。

您必须在app.config中在运行时重新绑定它们。但是,当您执行此操作时,VS2015将无法加载旧库,您必须注释掉该部分配置或其他方式。我们使用powershell脚本在构建服务器上自动取消注释该部分,因此部署到代理的是正确的配置。

您需要将以下内容添加到app.config:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.WindowsStore.CodedUITestFramework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.WindowsStore.UITest.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.WindowsStore.UITest.Extension" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.UITest.ExtensionUtilities" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.WindowsStore.UITesting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.1.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.WindowsStore.UITest.Playback" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>


<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.WindowsStore.UITest.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="UiaComWrapper.WindowsStore" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.CodedUITestFramework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.UITest.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.UITest.Extension" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.TestTools.UITesting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
  <assemblyIdentity name="UiaComWrapper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>