Does VS2010 Code Coverage support nUnit?

2019-02-01 20:32发布

According to this schema VS2010 Premium and Ultimate has a tool for checking Code Coverage - together with a few other testing tools. Does this support nUnit too, or just MS test?

9条回答
Bombasti
2楼-- · 2019-02-01 20:51

Visual Studio 2012 added support for third party unit test frameworks.

The test framework plugins available include:

  • NUnit
  • xUnit.net
  • MbUnit
  • QUnit
  • Jasmine

Adding support is very easy because you can add it from the Visual Studio Extension Manager.

For example you can add the "NUnit Test Adapter".

And now the "Analyze Code Coverage" works with third party unit framework. You can inspect all tests or only one.

And if your using VS 2010 don't be afraid to upgrade to VS2012 because sln files are compatibles (you need VS2010 with SP1).

查看更多
我想做一个坏孩纸
3楼-- · 2019-02-01 20:56

You need to turn off shadowcopy in NUnit to get it to work. To do so, use the /noshadow flag.

e.g. C:\Program Files (x86)\NUnit 2.6\bin\nunit-console-x86.exe MyLibrary.dll /noshadow

查看更多
一纸荒年 Trace。
4楼-- · 2019-02-01 20:59

Many of the answers in this thread helped me a lot, but it's hell to get all the little details from multiple answers.

I compiled a list of 6 hints that together with the marked answer by Scott Weinstein did the trick for me: Running NUnit tests in Visual Studio 2010 with code coverage

Although I don't deserve upvotes on both answers, just spare me downvotes for copying:

  • Scott Weinstein
  • John and Scott McKay
  • lili
  • mnemosyn

Upvote them!

查看更多
登录 后发表回答