Archives For TDD

Back in the good old days when I started doing unit testing and test-driven development, the way I ran tests was to start the NUnit Windows application, run the tests, wait for them all to go through and examine the result. Not exactly slow, but there is some friction, and a hint of context switching as a new window appears right on top of Visual Studio.

Earlier this year I purchased ReSharper from Jetbrains. Using their test-runner certainly reduced the friction compared to NUnit, but there were still the explicit steps of writing code, starting the unit tests, etc.

And then I discovered NCrunch, and all the friction was gone.

So what is NCrunch? To quote their website:

NCrunch is an automated concurrent testing tool for Visual Studio .NET.

It intelligently runs automated tests so that you don’t have to, and gives you a huge amount of useful information about your tested code, such as code coverage and performance metrics, inline in your IDE while you type.

What this means in practice is that NCrunch runs your unit tests as soon as you edit your code. I cannot stress enough what a game-changer this is. The feedback loop is cut down to practically nothing, and there is no┬áneed to stop and wait, or launch an external program. It’s just there and does its thing, and you can keep on writing code instead of continually disrupting your flow.

Once you start using NCrunch (or a similar tool, there are others, of course), it is very hard to go back to not having it. Like when you start using ReSharper and then use Visual Studio without it, it feels like something is missing.