From: Rich Kilmer Date: 2002-08-10T21:39:11+09:00 Subject: RE: Unit testing is considered harmful > -----Original Message----- > From: dblack@candle.superlink.net [mailto:dblack@candle.superlink.net] > Sent: Saturday, August 10, 2002 1:08 AM > To: ruby-talk ML > Subject: Re: Unit testing is considered harmful > > > > Ever since last year's Ruby Conference, where we talked a lot about > unit testing, I've been intrigued by the idea of having a test suite > serve as an actual definition of an interface -- and even different > test suites defining different versions. In the case of this coding > challenge, however, I was aware that the tests probably wouldn't be > enough -- which was on my mind when I wrote: > Not being "schooled" in unit test development, but contributing several infrastructure pieces to projects recently (FreeRIDE/FreeBASE, etc). I wrote this particularly interesting part of the FreeRIDE infrastructure named the 'databus' and I found myself iterating toward complete unit testing of my public interface/behavior while the unit tests served as a "sounding board" for my design (API simplicity, etc) as well as a verifier of functionality. It was much more back and forth for me than test first...all specifications defined...write code. More recently I had to make a major change to the code (like someone was depending on me getting it done as fast as possible). A little global search/replace covered most things...refactored some class names, then my tests failed...which I updated until they passed (to the newly refactored interface). I was moving quick...which was why I jumped into the code first...but the unit tests reminded me of what I could have done wrong. After 5 minutes I checked the code back in to CVS feeling very comfortable that my changes were solid and tested...which they were ;-). -rich