NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Code is Code (Score:1)
The reason I use testing libraries is that I don't want to retype the same code again and again, often badly and incompletely. Test::MockObject grew out of a pattern I noticed myself using in a particular situation, for example.
Every time I've neglected to treat test code as I would regular code, I've regretted it. It's all code and the normal strategies ought to apply.
Re: Refactoring Tests (Score:2)
With tests, it feels like there's two kinds of duplication: repeated test setup or utility code that's more involved with the mechanics of testing, and repeated code that involves the things under test. I usually factor the former into something like Test::Utility. The latter is more problematic. Some of it may be fair game to be moved off into a MyStuff::TestUtilities. The criteria for me, though, is wether the refactoring will reduce the readability of the tests.
Tests are a form of documentation. As d