414

I wonder what options there are for .NET (or C# specifically) code coverage, especially in the lower priced segment?

I am not looking for recommendations, but for a comparison of products based on facts. I know the following:

Laurel
  • 5,965
  • 14
  • 31
  • 57
Michael Stum
  • 177,530
  • 117
  • 400
  • 535
  • The question is already duplicated in https://softwarerecs.stackexchange.com/questions/123/tool-for-code-coverage-of-unit-tests-in-c. Can it be migrated & merged? – Michael Freidgeim Apr 02 '18 at 21:49
  • I didn't see AxoCover mentioned here, it is free and works quite well IMO: [https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover](https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover) – Brad Albright Apr 12 '19 at 13:15

12 Answers12

71

I use the version of NCover that comes with TestDriven.NET. It will allow you to easily right-click on your unit test class library, and hit Test With→Coverage, and it will pull up the report.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
David P
  • 3,604
  • 3
  • 37
  • 54
  • 5
    Gotta love TestDriven.NET; as it happens, I use VSTS, but I tend to use NUnit (not MSTes), and use TestDriven.NET to "Test With -> Team Coverage", which uses the MSTest coverage tool (including colorizing) with my NUnit tests. Fantastic. – Marc Gravell Nov 10 '08 at 07:01
  • This is what I used as well - until I moved my apps into 64bits :-( – galaktor Aug 17 '12 at 10:58
  • Doesn't work with .NET core yet. – Mariusz Jamro Aug 02 '18 at 19:44
46

An alternative to NCover can be PartCover, is an open source code coverage tool for .NET very similar to NCover, it includes a console application, a GUI coverage browser, and XSL transforms for use in CruiseControl.NET.

It is a very interesting product.

OpenCover has replaced PartCover.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838
  • 12
    PartCover has essentially been replaced by OpenCover (https://github.com/sawilde/opencover), as PartCover stagnated with support only for .NET 2. – David Keaveny Aug 31 '11 at 03:21
18

JetBrains (of ReSharper fame) has been working on a coverage tool for a little while called dotCover. It's showing a great deal of promise.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mike Two
  • 44,935
  • 9
  • 80
  • 96
15

I just tested out NCrunch and have to say I am very impressed. It is a continuous testing tool that will add code coverage to your code in Visual Studio at almost real time. At the time as I write this NCrunch is free. It is a little unclear if it going to be free, cost money or be opened source in the future though.

Laurel
  • 5,965
  • 14
  • 31
  • 57
Martin Odhelius
  • 990
  • 6
  • 15
4

TestCocoon is also pretty nice. It is in active development and has a user community:

  • Open source (GPL 3)
  • Supports C/C++/C# cross platform (Linux, Windows, and Mac)
  • CoverageScanner - Instrumentation during the Generation
  • CoverageBrowser - View, Analysis and Management of Code Coverage Result

However, TestCocoon is no longer developed and its creators are now producing a commercial software for C/C++.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    TestCocoon was renamed to [Squish Coco](http://www.froglogic.com/squish/coco/) when the main developer (and TestCocoon) joined [froglogic](http://www.froglogic.com/index.php). the current Squish Coco release also supports C#. – Frerich Raabe Apr 15 '14 at 13:52
3

There are pre-release (beta) versions of NCover available for free. They work fine for most cases, especially when combined with NCoverExplorer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jalbert
  • 3,047
  • 2
  • 20
  • 21
2

I am not sure what the difference is with the retail NCover, but there is also an NCover project on SourceForge that is of course open source and free.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 2
    The version on Sourceforge is the basis for the current versions of NCover. It's not being actively worked on/supported anymore but still widely available. They are up to version 3.0 now. – Valien Aug 14 '09 at 19:37
1

C# Test Coverage Tool has very low overhead, handles huge systems of files, intuitive GUI showing coverage on specific files, and generated report with coverage breakdown at method, class, and package levels.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kanwar Singh
  • 908
  • 12
  • 21
1

TestMatrix is a unit test runner and code coverage tool.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
sergeb
  • 2,484
  • 3
  • 22
  • 20
1

See the C# Test Coverage tool from my company, Semantic Designs:

It has very low overhead, handles huge systems of files, intuitive GUI, howing coverage on specific files, and generated report with coverage breakdown at method, class and package levels.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
0

Code coverage features, as well as programmable API's, come with Visual Studio 2010. Sadly, the only two editions that include the full Code Coverage capabilities are Premium and Ultimate. However, I do believe the API's will be available with any edition, so creating code coverage files and writing a viewer for the coverage info would likely be possible.

jrista
  • 32,447
  • 15
  • 90
  • 130
0

We've released EAP to dotCover and will be releasing the beta version soon.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hadi Hariri
  • 4,656
  • 2
  • 24
  • 13