Kent Beck has probably been more responsible for the uptake of automated testing amongst the general developer population than any other figure over the last five years. One of the reasons is that he’s such a great speaker and writer that you can’t help but paying attention. Another, of course, is that automated testing is naturally a Good Thing to do, so it shouldn’t be such a hard sell.
Anyway, as the second edition of his Extreme Programming Explained is hitting the street, Kent has broadened his focus from just testing to the concept of software health. It’s not just about passing the tests today, it’s about being in a position that allows you to pass the test tomorrow too.
When you come back, all energized with a strong desire to improve the health of your software, do check out Steve Kellock’s A Guide to Testing the Rails. Rails is uniquely supportive of getting your test game on with the least amount of configuration or even learning. For all the controllers and models generated, you already have test suites waiting for test cases to enter. And running
rake will execute the whole lot of them.
If you do need a bit more assistance in exactly how you should do testing, and especially unit testing, I can heartily recommend the Pragmatic Unit Testing book by Andy Hunt and Dave Thomas. It’s available in both a Java and C# flavor, but don’t let that scare you off, pretty much all of the meaningful lessons apply directly to any environment. Combined with Steve’s guide, you should be all set.
As a rule of thumb, you want your
rake stats to report that you have a 1:1 ration between code and tests.