A while ago I found myself working alone on a small application. As it was just me I decided to forego the setup of CI, etc and just get on with developing the app. I used TDD initially and for a time all was well.
After a while I gave a demonstration of the app. The demo went well and it led to lots of feature requests. Of course everyone wanted the features ASAP and I found myself lured into bad habits. For no other reason than a bit of sloppiness on my own part I started developing more and more without tests.
The app was small and easy to manage so it wasn’t a big deal but I was unhappy that I had let things slip. My initial reaction was to beat myself up but after a while I realised that I hadn’t really set myself up for success.
In a team where TDD is the norm then there is peer pressure to deliver tests into the CI environment without breaking the build. Breaking the build equals good natured (hopefully) complaints from the rest of your team – so you take steps to ensure that when you check in it works and it has decent test coverage.
When you’re on your own or you’re a lone TDD’er in a team that is yet to embrace TDD you don’t have that pressure and in fact you may not have a CI environment at all.
But you see, its that lack of feedback and peer pressure that lets you lower your standards. Its very easy to convince yourself that you will go back and fix it when you get a chance but without facing hard evidence you don’t know how bad things have got.
So, I resolved to find something to help me. In this particular case I found NCrunch to be invaluable. It basically runs your unit tests in the background and provides visual indication of test coverage (little circles next to each line of code with red, green or blank) and alerts any failing tests. It makes it incredibly easy to slip back into the test first way of working – you soon find yourself making changes and then waiting, with a certain amount of anticipation, for NCrunch to report the result.
I’ve now got a much healthier test coverage. I find it so useful that I don’t think I would develop software without it (or something similar – I use Nosy for Python development now) as I find the immediate feedback fits beautifully with the test, fail, fix flow of TDD.