Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a free code coverage tool suitable for use with .NET 4 and NUnit?

Is there a free code coverage tool suitable for use with .NET 4 and NUnit that runs from the command line (and is thus suitable for use on a build server)?

Please note that any tools that require editions of Visual Studio higher than Professional are not appropriate in this case.

I am asking this question because I can't get NCover 1.5.8 to work with NUnit 2.5.5 on a .NET 4 C# app. I can run the unit tests, and I can generate a Coverage.Xml file, but it is empty - it contains no sequence points. After a lot of research, I have concluded that this is because NCover 1.5.8 simply doesn't work with .NET 4. However, if you know better, please feel free to answer this question from another user.

like image 502
Damian Powell Avatar asked May 29 '10 18:05

Damian Powell


People also ask

Is Nunit a code coverage tool?

This is actually a code coverage utility tool developed specifically for Java.

How do I get Nunit code coverage?

Instaling OpenCover OpenCover is the tool which measures the code coverage of your unit test cases. Builds can be downloaded from https://github.com/OpenCover/opencover/releases/tag/4.7.1221. All you need to do is download and extract the zip file. I have extracted OpenCover to c:\Utilities.

Which plugin is used for getting code coverage for .NET projects?

JetBrains dotCover is a . NET unit test runner and code coverage tool that integrates with Visual Studio and JetBrains Rider. Make sure you know to what extent your code is covered with unit tests. dotCover calculates and reports statement-level code coverage in applications targeting .

What is code coverage tools for C#?

Code coverage tools allow you to measure how much tested and untested code you have in your codebase. In this post, you will find out what are the best code coverage tools for C# to use in 2022 and beyond: dotCover. NCover.


2 Answers

There is PartCover And two forks of partcover,

Sharpcover here

And Partcover-fork here

All seem defunct. Not sure about .net 4 compatibility but partcover ran ok on 3.5 code. I'd love to see someone pick these up.

edit Add one more to the mix. With .net 4 coverage as the intent http://wiki.github.com/sawilde/partcover.net4/

like image 199
nportelli Avatar answered Oct 11 '22 07:10

nportelli


NCover has held the code coverage niche for the .NET market for some time, probably since it first went commercial. I suspect the issue is that the old free version was compiled for .NET 2, and .NET 4 is sufficiently different the old NCover now won't work correctly.

For what it's worth, NCover 3 seems the most viable option. Admittedly not free, but the cost isn't too bad for the Classic version. I've been trialling it recently, and it's worked fine against a .NET 4 application. And it's much cheaper than a higher-end version of Visual Studio.

like image 26
Grant Palin Avatar answered Oct 11 '22 08:10

Grant Palin