From: Dave Thomas Date: 2001-11-19T02:32:14+09:00 Subject: [ruby-talk:25769] Re: rubyUnit, et. al. Albert Wagner writes: > I am curious about how others work; And how unit testing is really > used: as a predefinition of specs or tacked on after-the-fact to > convince others that you are PC (Politically Correct). Don't tell the XP crowd, but I do both. Not just to be Politically Correct, but also to be Programmatically Correct. I do test first when I want to explore the interfaces, or alternatively when I understand the interfaces 100%. I code first when the code itself will shape the interfaces (that is where the functionality is more important than the interface to it: if providing an interface a certain way makes the code twice as easy to write, I want to know about it). However, the tests aren't just window dressing. They're there to liberate me. If I have a good set of unit tests, then I can make changes without worrying too much about ripple-on effects: I make the change, run the tests, and if I've messed up, I can unmake the change. Typically I run the tests in Ruby every line or two of code: it takes no time, and it keeps me on the straight and narrow. One last thing: unit tests ar a great way to submit bug reports... Dave