c# - 单元测试适配器抛出异常

标签 c# unit-testing automation ui-automation coded-ui-tests

运行编码的 ui 测试方法时,我遇到如下所示的异常。

它在进入测试方法主体并返回异常之前终止

Message: Unit Test Adapter threw exception: Could not load type 'Microsoft.VisualStudio.QualityTools.UnitTestFrmework...

如下图所示,图片库已经添加。

enter image description here

我在整个项目中使用以下版本

Microsoft.VisualStudio.QualityTools.CodedUITestFramework //version 14.0.0.0
Microsoft.VisualStudio.QualityTools.UnitTestFramework //Version 10.1.0.0
Microsoft.VisualStudio.TestTools.UITest.Common //Version 14.0.0.0
Microsoft.VisualStudio.TestTools.UITest.Extension //Version 14.0.0.0
Microsoft.VisualStudio.TestTools.UITesting //Version 14.0.0.0

谢谢。

最佳答案

我刚刚检查了我的 app.config,发现其中添加了以下几行。

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

我不知道这是怎么发生的,但是当我删除它时,一切都开始正常工作。

关于c# - 单元测试适配器抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43092233/

相关文章:

c# - Linq加入c#

c#检查2个字符串是否包含相同的字符

c# - .Net Core 2.2 中的 OData : how to get total number of items?

c# - 如何分配 Excel VSTO 安装的程序集位置?

node.js - 使用 sinon 模拟连接池和测试 url 参数?

unit-testing - 为从中读取的函数填充 os.Stdin

java - 无法启动实际应用程序,但加载 helloworld

python - 正确终止Python中的selenium浏览器

java - JUnit 测试 - 进行测试的最佳且最可靠的方法?

.net - 为 Windows Forms .NET 寻找一些好的 GUI 测试框架/GUI 自动化测试工具