> There is this big hairball of under-tested code. (Nothing new here) > So the question is, which to tackle first - unit tests, or functional tests.
Generally, I agree with the earlier responders endorsing your approach and I've little to add to their thoughtful remarks. Perhaps the major benefit of unit tests is that they improve design: * writing a test first forces you to focus on interface * hard to test code is often hard to use * simpler interfaces are easier to test * functions that are encapsulated and easy to test are easy to reuse * components that are easy to mock are more flexible/extensible That is, unit tests provide more value for new development work. If you already have a big ball-o-mud, unit tests provide less value. The time to write unit tests for an existing system, is when you choose to rewrite a component/subsystem. This sort of question has been asked a few times at Perl monks. See, for example: http://www.perlmonks.org/?node_id=355203 http://www.perlmonks.org/?node_id=560614 > Why am I wrong? You're not. :-) Cheers, /-\ Send instant messages to your online friends http://au.messenger.yahoo.com