Jason Bock

Home Biography Speaking Articles Books Music

Write Your Tests First … Because Adding Them Later Sucks

Seriously. Right now I’m trying to add tests around a section of code that doesn’t have any, and it’s not fun. Why? Here’s a couple of thoughts that spring to mind:

Write your tests first, or at least write them in conjunction with your new code. I find that it’s so much easier to have your tests in place with new code rather than trying to bang out tests with untested code that’s been around for a while. In the end, having tests is better than having no tests (assuming the tests are good ones) but don’t wait to write them until it’s too late.

Published: 12.10.2007 07:56:13 AM CST