What are the most effective (freely available) tools for C# code coverage? [closed]
Visual Studio C# Express edition is an adequate IDE when it comes to writing C# - and NUnit is an adequate framework for writing unit tests. This pairing, however, isn't sufficient to establish the code-coverage of these tests.
I realise that the Professional and Ultimate editions integrate with 开发者_C百科MSTest and provide fully integrated code-coverage... but this restricts verification of coverage to those who have purchased the relevant IDE - which isn't ideal.
I'm not worried about integration of coverage analysis into the IDE... that's one approach, but I'd be equally happy with a report generated by a batch process... this could be integrated into continuous integration.
I am concerned about the quality of the coverage metrics - for example, I'd want branch-level coverage analysis not just line-level.
I'm imagining that Visual Studio Professional/Ultimate is not an idea solution for developers in a Mono environment... can anyone tell me what's typically used in such a context?
NCrunch is pretty cool. It gives you visual indicators on the left side of your code to let you know if it is covered, and if the tests on it have passed.
http://www.ncrunch.net/
OpenCover and PartCover are currently the two main tools.
PartCover is the oldest and is no longer actively maintained on SourceForge. Support for this utility has since moved to GitHub (PartCover on GitHub)
OpenCover is newer and is also on GitHub (OpenCover on GitHub) it has 64 and 32 bit support and overcomes some of the limitations that PartCover has (memory and results delivery).
Both are supported by TypeMock (I think OpenCover support is being added soon see Can Opencover be used with TypeMock Isolator?)
Reports for both PartCover and OpenCover can be supplied using ReportGenerator ()
PartCover?
Or SharpDevelop? SharpDevelop is an alternate IDE which has more features than Express version of VS.
I'm surprised no one has mentioned this, but visual studio Team Edition comes with a code coverage tool. ( It's part of the Team Tools suite). Also when you run unit tests in VS Team Edition, it performs code coverage AUTO-MAGICALLY. :)
So it's free in a sense if you already have Team Edition, but of course Team Edition costs a bit more. So there you go.
精彩评论