13

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.

Community
  • 1
  • 1
Damian Powell
  • 8,655
  • 7
  • 48
  • 58

4 Answers4

5

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/

nportelli
  • 3,934
  • 7
  • 37
  • 52
2

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.

Grant Palin
  • 4,546
  • 3
  • 36
  • 55
  • 1
    ... and with "NCover Loves Devs" offer it gets even cheaper: http://www.ncover.com/we_love_devs – The Chairman Jun 09 '10 at 16:15
  • 1
    It appears that deal has expired. – Larry Fix Jun 25 '10 at 17:35
  • I downloaded an NCover trial (21 days) to try out and it seems good so far. The support docs are also useful - my case is just using it with MSTest, but I also wanted to merge the resulting coverage results, and it can do that too. – dodgy_coder Mar 21 '12 at 02:06
2

FYI: PartCover now supports .NET 4.0

Shaun Wilde
  • 8,228
  • 4
  • 36
  • 56
0

I think the short answer to this question is "No".

I found out that it is possible to get NCover 1.5.8 working with a bit of hacking* but it seems that there's nothing out there that's free that supports .NET 4. If you find otherwise, comment on this post or the question, and I'll happily accept a more appropriate answer.

(*) "The trick is to set the environment variable: COMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler"

-Jamie Cansdale

Damian Powell
  • 8,655
  • 7
  • 48
  • 58
  • Last link in my post someone is going for .net 4 coverage. http://wiki.github.com/sawilde/partcover.net4/ – nportelli Jun 23 '10 at 19:48