
After reading Perl Testing, A Developer's Notebook, I started putting this into all the WebGUI tests:
my $loaded = use_ok('WebGUI::Module');
SKIP: {
skip $number_of_tests_to_skip, 'Unable to load module' unless $loaded;
}
It worked great for syntax testing the module before running the test, but the block required variables that needed to be cleaned up to be declared outside, it required extra indenting, and many people didn't like it.
Graham mentioned that since we already have a syntax checking test, t/syntaxCheck.t, that it was redundant to do it twice. Then he sped up syntaxCheck.t, moved it to 00_compile.t so that it would run before any of the other tests in the suite, and had it BAIL_OUT so that the testing process would stop.
00_compile.t also makes a nice git pre-commit hook.
So, from here on out, save some typing and skip the conditional load check in your WebGUI tests.

Copyright 2010 perlDreamer Consulting | All Rights Reserved | Site Map | Graphic Design by Plain Black