Re:Ask YC: Does anybody enjoy unit testing their code?
by dcminter on Thursday June 12, 2008 @09:20AM
(#215893)
Yes and no (is there ever any other answer?)
I enjoy unit testing when it all lights up green and I'm doing TDD. What I don't enjoy is retrofitting unit tests to my code. Time spent debugging the unit tests themselves (when I know the code is ok for at least a small value of "working") always feels frustrating and wasteful.
I find that TDD doesn't work well for exploratory programming where I'm feeling my way around a new library, or trying to work out a satisfactory architecture for a new component.
It's well worth it for future maintainability but certainly sometimes it is a chore.
I enjoy unit testing when it all lights up green and I'm doing TDD. What I don't enjoy is retrofitting unit tests to my code. Time spent debugging the unit tests themselves (when I know the code is ok for at least a small value of "working") always feels frustrating and wasteful.
I find that TDD doesn't work well for exploratory programming where I'm feeling my way around a new library, or trying to work out a satisfactory architecture for a new component.
It's well worth it for future maintainability but certainly sometimes it is a chore.