I’ve been writing Test Driven code for the last few years and it’s become a natural part of the way I write most code. It was only recently that a co-worker, relatively new to Test Driven Development commented on something I’d never taken notice of.
We were in the midst of some work and ended up with some strange behaviour when we clicked through our application. We inspected the tests to ensure all the tests looked like they were working, and then proceeded to fire up the debugger. My pair then commented, “I’ve noticed you rarely use the debugger when you Test Drive your code”, and you know, he was very correct.
I wouldn’t never say you never need to debug during Test Driven Development (especially when it comes to diagnosing system state and certain triggers) but you definitely spend significantly less of your time in debug mode as you’re verifying bits of your code along the way. And that’s certainly a better place to be.