No Comments February 6, 2012

A few months ago I was introduced by a colleague to a fantastic Visual Studio extension called NCrunch, and in a single stroke it has managed to almost completely change the way that I write, develop and maintain code (for the better).

NCrunch is an automatic continuous testing tool that, in the background, runs your unit tests against your code while you are developing. It adds a column of status indicators to your editor, which shows you three things:

  • Lines of code that are not covered by any unit tests
  • Lines of code that are covered by unit tests where all unit tests pass
  • Lines of code that are covered by unit tests where at least one test is failing


So, if I make a change to my code while I'm implementing a new business requirement or refactoring I get almost immediate feedback that my code has or hasn't adversely affected my other code paths (assuming that is that I've got appropriate unit test cases written for my code).

Which is the other great thing about NCrunch from my perspective - over time, the presence of a black dot to the left of your code that indicates that you've not got any unit test coverage for a particular code path starts to grate. In fact, whenever I've had to write code recently in projects that have no code coverage I've almost felt dirty - that little black dot keeps nagging me to drop what I'm doing and get some proper unit test coverage in place.

The ultimate accolade I can give NCrunch is that when I built a new development environment a few weeks ago, firing up Visual Studio without NCrunch (and ReSharper for that matter) felt unnatural and incomplete - a lot of extensions are 'nice to have', but this is now on my immediate install list.

NCrunch is still in beta at the moment and undergoing active development so there are sometimes some rough edges, but even given that it has been one of the most useful tools I've ever used.

No Comments