简体   繁体   English

为什么我的TearDown方法抛出以下System.TypeLoadException?

[英]Why is my TearDown method throwing the following System.TypeLoadException?

The Set Up 设置

I have TFS 2012, VS 2013 and Test Controller 2013 on my machine which runs Windows 8.1 x64 我在运行Windows 8.1 x64的计算机上安装了TFS 2012,VS 2013和Test Controller 2013

I have installed a Windows 7 x86 VM and on it I've installed VS 2012, VS 2013 and Test Controller 2012 (in that order). 我已经安装了Windows 7 x86 VM,并在其上安装了VS 2012,VS 2013和Test Controller 2012(按此顺序)。 The VM is my test controller. VM是我的测试控制器。

The Issue 问题

I'm attempting to test a very simple scenario where I have a Coded UI test (manually programmed; I didn't use the record and playback feature) where Internet Explorer is launched with google.com and I search for the term calculator 我正在尝试测试一个非常简单的场景,在该场景中我进行了编码UI测试(手动编程;我未使用记录和播放功能),其中Internet Explorer是通过google.com启动的,并且我搜索术语计算器

This works just fine on my machine. 这在我的机器上工作正常。 When I try to run the test via Test Manager, however, I get the following error: 但是,当我尝试通过测试管理器运行测试时,出现以下错误:

TestCleanup method CalculatorTest.TestCases.CalculateTest.TearDown threw exception. TestCleanup方法CalculatorTest.TestCases.CalculateTest.TearDown引发异常。 System.TypeLoadException: System.TypeLoadException: Could not load type 'Microsoft.VisualStudio.TestTools.UITesting.ApplicationBase' from assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.. System.TypeLoadException:System.TypeLoadException:无法从程序集“ Microsoft.VisualStudio.TestTools.UITesting,版本= 11.0.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a”中加载类型“ Microsoft.VisualStudio.TestTools.UITesting.ApplicationBase”。

The browser launches with google.com but it closes soon after without performing the search and the above error message is shown in Test Manager. 浏览器随google.com一起启动,但在不执行搜索后不久即关闭,并且以上错误消息显示在测试管理器中。

Could anyone please help me by shedding some light on the reason behind this? 有人可以通过一些背后的原因来帮助我吗?

It seems like a Visual studio versioning issue and I am guessing that since you have both VS2012 and 2013 installed, the incorrect version of the assembly is being loaded. 似乎是Visual Studio的版本控制问题,我猜想由于您同时安装了VS2012和2013,因此正在加载不正确的程序集版本。 I would have a look at the reference of the assembly that it fails to load and check that in the references, the specificversion property is set to false. 我将查看无法加载的程序集的引用,并检查在引用中是否将specificversion属性设置为false。 If this doesn't work, try removing and re-adding the reference (eg the 2012 framework version) if that is what you are running under. 如果这不起作用,请尝试删除并重新添加引用(例如2012框架版本),前提是您正在运行该引用。

请尝试将本地副本设置为“ true”作为参考,然后创建一个要使用MTM进行测试的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM