Reputation: 2029
I'm using the Test::Unit::Lite module from CPAN to run tests which are set up like:
t/FooTest.pm
t/BarTest.pm
I've been running all the tests with the test.pl script from the Test::Unit::Lite man page, but I can't figure out how to run the tests from just one file while I iterate on the tested functionality.
From another answer, it looks like it may only be possible to do it by moving my tests into subdirectories, or otherwise modifying them, but I'm surprised if there is no easier way to do it.
Upvotes: 0
Views: 122
Reputation: 2029
Figured out how to do this.
At the end of test.pl, I swapped out
all_tests
and replaced it with
if (@ARGV) {
for my $t (@ARGV) {
Test::Unit::TestRunner->new->start($t);
}
} else {
all_tests;
}
I also had to add
unshift @INC, File::Spec->catdir($cwd, 't/tlib');
after the line
unshift @INC, File::Spec->catdir($cwd, 'lib');
Now I can do "test.pl FooTest" or "test.pl BarTest" or "test.pl" to run all tests.
Upvotes: 1