I am using
Test::Class to do my unit tests for a large distribution that I'm beginning. I really like Test::Class as I can neatly package stuff up in inherritable methods instead of writing long, spaghetti-esque procedural test scripts which offend my sense of style. (Just ask
perrin <grin>).
The docs for Test::Class suggest putting your test modules under t/lib. I understand that this will prevent them from being indexed by PAUSE, which is good. My concern arises over including this directory in my test script, t/main.t, which looks like this:
#!/usr/bin/perl
# t/main.t -- launch all tests from here
use strict;
use warnings;
use lib './t/lib';
use Test::Class;
use MyApp::Test;
use MyApp::Foobar::Test;
Test::Class->runtests;
This works fine on my system, but I'm worried that the use lib might break on other OSes, especially with the hardcoded relative path. Is there an accepted standard way of doing this which is better?