I discovered a nice testing technique while coding my ever useless module (Acme::MetaSyntactic). I had trouble defining the API, so I finally wrote down 5 or 6 sample scripts. They all did the same thing, using the API in a different way.
What's nice is that it's quite easy to test that all the use cases behave in the same way:
use Test::More;
use File::Spec::Functions;
my @cases = glob catfile qw( t cases case* );
plan tests 2 * @cases;
for my $case (@cases) {
# you can add more command-line options
my $result = `$^X -Mblib -Mstrict -w $case`;
is( $? >> 8, 0, "$_ ran successfully" );
# and the tests for $result can be fancier
is( $result, "whatever's expected", "result" );
}
As a bonus, there is no need to update the tests when adding a new testcase!