Is there a way to see the code coverage when using nUnit? I know there's such a feature in Visual Studio, but can you use it with nUnit or only with the built-in vs unit tests?
-
17The question doesn't ask any recommendation for tools. It asks about nunit and visual studio code coverage features. – Vlad Jul 16 '15 at 12:31
-
I've installed http://www.nuget.org/packages/NUnitTestAdapter.WithFramework/ and VS2013 managed to show me my code coverage – silver May 24 '16 at 07:40
5 Answers
You can use NCover. Now its commercial, but version 1.5.8 (at the bottom of page, community edition) is still free and if you want to visualize it, then use NCoverExplorer.
EDIT:
It's possible to wrap nUnit or mbUnit with Visual Studio code as well. VSTS Code Coverage Runner

- 1,914
- 13
- 11
-
7Just downloaded TestDriven.NET and apparently nCover is integrated in it. Very cool, the code coverage. Makes you see right away if you have things not covered in certain classes. Thx. – Lieven Cardoen Nov 17 '09 at 10:01
-
OpenCover is an open source code coverage tool https://github.com/OpenCover/opencover – David Clarke Apr 21 '17 at 00:47
Visual Studio 2012 finally added support for third party unit test framework.
You can add frameworks using the Extension Manager and automatically "Code coverage" starts working with installed framework.
Code coverage is available only in Visual Studio Ultimate or Premium editions.
See my reply in Does VS2010 Code Coverage support nUnit?
PartCover is free and I've just blogged how to use it with NUnit See this link

- 3,020
- 2
- 24
- 20
-
2PartCover is not supported anymore the "new" thing is OpenCover https://github.com/OpenCover/opencover – Jernej Novak Feb 17 '17 at 13:24
See SD C# Test Coverage. Comes with built-in visualization of test coverage data over your source code as well as summary reports.

- 93,541
- 22
- 172
- 341
If you work at a company with a security-/saving-money-/hassle-employees- policy restricting your choice to VS2010 (Premium or Ultimate), see my answer to: Running NUnit tests in Visual Studio 2010 with code coverage
There, I refer to this other answer, but also give some more details than that: Does VS2010 Code Coverage support nUnit?
I know, copied/referring answers (esp. of others) are worth downvoting, but as I said, I give some details, which would've helped me quite a lot.