[Melbourne-pm] New Testing Module

Josh Heumann melbourne.pm at joshheumann.com
Thu Nov 13 02:44:44 PST 2008

At last night's meeting, I was reminded to post about a new module I
wrote: Test::UniqueTestNames.


It's a simple little module.  It just runs an extra test at the end that
makes sure that all of your test names were unique.

It behaves just like Test::NoWarnings, adding one to the total number of
tests that you ran, and gives some nifty diagnostics at the end if you
had tests with duplicate names.

Why is this useful?

Well, say you have some test in a loop:

for( 0..9 ) {
    is( always_return_13( $_ ), 13, 'returned 13' );

...and one of them breaks.  Just one.  How do you know?  It's much
easier to debug if it looks like this:

for( 0..9 ) {
    is( always_return_13( $_ ), 13, "passing in $_ returned 13" );

For some of you, this is already common practice, but if you're working
with a lot of people who might not always give their tests unique names,
it's handy.  And it's on a cpan mirror near you.


More information about the Melbourne-pm mailing list