What can I use for good quality code coverage for

2019-01-01 07:50发布

问题:

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:

  • NCover
    • Seems to be very popular and looks quite good
    • Supports statement coverage and branch coverage
    • $480 for \"NCover 3 Complete\"
    • Older beta versions are available for free
  • Visual Studio (2008 Pro) | (2005 Team System (Development, Test or Team Suite Editions))
    • Well, it\'s Microsoft so I\'d expect it to work properly
    • Fully integrated into Visual Studio
    • At least $5,469
  • PartCover - no further development (moved to OpenCover)
    • Open source
    • Supports statement coverage
  • OpenCover - successor to PartCover
    • OpenSource
    • Supports branch and statement coverage
    • 32 and 64 bit support
    • Silverlight support
    • Background
    • Tutorial on The Code Project by the primary developer
    • No .NET Core support yet
  • SD Test Coverage
    • Works with 32 and 64 bits, full C# 4.0
    • Handles both small and very large code bases
    • $250 for single user license
  • JetBrains dotCover
    • $100 for Personal License. Free for user groups, open source projects, students and teachers.
    • Supports statement coverage
    • Silverlight support
  • NCrunch

    • $159 for personal license
    • $289 for commercial seat license * Free during beta, to become commercial, pricing unknown future unknown.
    • Code coverage indicators in Visual Studio
    • Continuous (near real time) testing
    • Visual per-test code coverage
    • Performance metrics, parallel multi-core test execution
  • NDepend

    • $410 for developer license
    • NDepend can import coverage data from NCover, DotCover, Visual Studio 2017; 2015, 2013, 2012, 2010 and 2008 Code Coverage files.
    • Dependency graph
    • Dependency structure matrix
    • Visualizing code metrics
    • Validating code rules

回答1:

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.



回答2:

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 CC.Net.

Very interesting product.

UPDATE: OpenCover has replaced partcover.



回答3:

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.



回答4:

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.

http://blog.ncrunch.net/image.axd?picture=2012%2f4%2fPerformanceCoverage.jpg



回答5:

TestCocoon is also pretty nice: http://www.testcocoon.org/index.html with active development and user community:

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

EDIT:Test cocoon is no longer developed and its creators are now producing a commercial software for C/C++



回答6:

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



回答7:

Not sure what the difference with the retail NCover, but there is also an NCover project on sourceforge that is of course open source and free.



回答8:

TestMatrix is a unit test runner and Code Coverage tool.



回答9:

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

http://www.semanticdesigns.com/Products/TestCoverage/CSharpTestCoverage.html

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.



回答10:

http://www.semanticdesigns.com/Products/TestCoverage/CSharpTestCoverage.html

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.



回答11:

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.



回答12:

We\'ve release EAP to dotCover (http://www.jetbrains.com/dotcover) and will be releasing the Beta soon.