Test Everything, No Matter How Simple
Tuesday, August 22nd, 2006There are many reasons to write your tests first. An oft unmentioned benefit is that it makes the programmer stop and think about what they’re doing. More often than you’d expect, the obvious fix is not the right answer; and writing the test first can reveal that.
For example, recently Wolfgang Hoschek pointed out that in XOM the Attribute
class’s setType()
method was failing to check for null. Once he pointed it out, it was an obvious problem so I opened up Eclipse and got ready to fix it:
(more…)