的Visual Studio 2012的假货UnitTestIsolation仪器初始化失败 [英] Visual Studio 2012 fakes UnitTestIsolation instrumentation failed to initialize

查看:194
本文介绍了的Visual Studio 2012的假货UnitTestIsolation仪器初始化失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚装VS 2012更新2( http://www.microsoft.com/ EN-US /下载/ details.aspx?ID = 36833 ),这样我就可以使用VS假货/垫片测试一些难以测试的代码。当我创建了假冒的程序集和所有引用的单元测试项目中添加的预期一切编译就好了。但是运行下面的代码中的任何测试...

Just installed vs 2012 update 2 (http://www.microsoft.com/en-us/download/details.aspx?id=36833) so I can use vs fakes/shims to test some hard to test code. Everything compiles just fine when I create the fake assemblies and all references are added within the unit test project as expected. However running the following code in any test...

using (ShimsContext.Create())
{
    //Doesn't matter whats in here
}

抛出以下异常。 ..

Throws the following exception...

Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException : UnitTestIsolation instrumentation failed to initialize.  Please restart Visual Studio and rerun this test

完整的异常与堆栈跟踪...

Full exception with stack trace...

Test 'Abot.Tests.Unit.Core.HapHyperLinkParserTest.HyperLinkParserTest.GetLinks_AreaTags_ReturnsLinks' failed: Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException : UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
at Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()
Core\HyperlinkParserTest.cs(59,0): at Abot.Tests.Unit.Core.HyperLinkParserTest.GetLinks_AreaTags_ReturnsLinks()

的几点说明...


  • 我使用的Visual Studio 2012高级

  • 在溶液中的目标所有项目.NET 4.0

  • 我使用NUnit的测试框架

  • 尝试运行通过testdriven.net插件和NUnit GUI,但同样的错误的测试。

  • 试过针对.NET 4.5,并得到了同样的错误

  • 我不使用Typemock或Ncrunch,他们不安装

  • 我用的起订量,但是从日删除它

  • 它不依赖于具体的测试,我已经验证了它在不同的测试文件,并在另一个解决方案,以及失败。

  • I'm using visual studio 2012 premium
  • All projects in the solution target .net 4.0
  • I'm using nunit for the testing framework
  • Tried running tests through testdriven.net plugin and nunit gui but same error.
  • Tried targeting .net 4.5 and got the same error
  • I'm NOT using Typemock or Ncrunch and they are not installed
  • I am using Moq but removed it from the th
  • Its not tied to a specific test, i've verified it fails in different test files and in another solution as well.

推荐答案

马修是正确的。你必须使用VS测试运行。

Matthew was correct. You have to use the vs test runner.

-Had通过扩展管理器,它可以让VS测试运行器来运行NUnit的安装NUnit测试适配器0.94。

-Had to install the NUnit Test Adapter 0.94 through the extension manager which allows vs test runner to run nunit.

-Had使用VS测试浏览器窗口来运行测试。

-Had to use the vs test explorer window to run the tests.

貌似试运行封装在上下文中,使假货魔术发生的运行测试。

Looks like the test running wraps the running tests in a context to make the fakes magic happen.

这篇关于的Visual Studio 2012的假货UnitTestIsolation仪器初始化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆