in reply to When test-driven development just won't do
Minor suggestion on the can_ok, based on some code I was recently writing:
no strict 'refs'; ok( defined *{$CLASS."::".$method}{CODE}, "$CLASS has $method")
At issue for testing is always whether a test really tests what you want. In this case, for example, can_ok $CLASS, $method isn't what you want if you want to know whether a method exists in a particular class. I find that test-driven development works for me because it makes me specify more clearly what behavior I want before I go write the code.
For the first general case you raise, my view is that one writes the test as soon as one knows what the expected behavior is. Until that's defined, playing around is OK. For the second case, while I've not had to tackle that kind of project, if I did, I'd approach it top-down, not bottom up. E.g., write a "total program" test that takes certain input and gives the actual existing output, then start to work on macro testing of major subsystems, etc.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: When test-driven development just won't do
by Ovid (Cardinal) on Aug 04, 2005 at 18:54 UTC | |
by xdg (Monsignor) on Aug 04, 2005 at 19:27 UTC |