Monday, January 27, 2014

NCrunch - my favourite test runner

What is your favourite test runner? I have been using many different test runners over the years. Once in a while I find a better one and switch to that. Like I mentioned in my previous blog post Pillars of Unit Tests, one of the most important things when establishing a test environment is the ease of use. Running the tests should not be a hurdle.


I stumbled upon NCrunch some time ago, a .Net test runner for Visual Studio. This is represents a whole new paradigm when it comes to running tests. Actually the developer does not need to run the tests anymore -- NCrunch does it for you while typing. You don't even need to save the file!

While you edit the code, NCrunch uses coloured dots to the left of the code to indicate the test status of that particular line.

Hopefully your code usually looks like this, with happy green dots covering everything. That means your code is covered by passing tests. Production code is to the left and test code to the right:

All systems operational
Let's try to introduce a bug... just for the fun of it. Red dots appear at all lines in the production code that are covered by failing tests. Note the red x on one of the lines in the test. This is the offending line that makes the test fail.

What if we comment out some tests so that parts of the production code is no longer covered by tests? NCrunch marks the non-covered lines with black dots... and all bets are off!

Pretty impressing, and quite useful. You'll find it at

By the way, I am not affiliated with the authors of NCrunch in any way. I'm just a happy user.

No comments:

Post a Comment