What does NCover do for you?

NCover highlights areas of code which are not being exercised by your tests.

How does NCover work?

NCover reports the percentage of branches in the code that have been taken throughout the course of your automated testing. It achieves this by instrumenting the source code at each branch, and writing the 'hit' points to a file. These 'hit' points are then compared to the total possible points that could have been 'hit'.

Code coverage can help by identifying:

  • Areas of code that need additional testing.
  • Dead code (code that doesn't do anything either because it should be deleted or due to a bug).
  • Dead files not included in solutions but still in CVS.


There are certain prerequisites for our code coverage tool. We believe that if you don't have these methods / tools in place, you'd be better off spending time adding these things than mucking around with code coverage.
Before you begin you need:

  • An automated build process (E.g. nant, ant, devenv)
  • Automated tests (E.g. nunit)
We would recommend (although it's not essential) that you add a continuous integration process to regularly build and run tests before worrying about code coverage.


If you feel that there are better / alternative ways we can repackage NCover to make it easier for you to use then please either email or add a feature request. We like feedback (honest!).