I noticed that in Perl the custom is to stick all tests into the t directory. How do you separate the unit test from the functional ones? Or, to make the question simpler and more obvious, how do you separate the tests that run quickly from the ones that do not? When all the tests run together the testing takes too long to be routinely used in development, which is a pity.
I figured I could set some environment variable like QUICK_TEST
and skip the long tests according to its value. Do you separate unit and functional tests? How? (This is not meant to be a poll – I just thought maybe there’s some idiomatic solution.)
Update: So far I have come to this:
package Test::Slow;
use strict;
use Test::More;
BEGIN {
plan(skip_all => 'Slow test.') if $ENV{QUICK_TEST};
}
1;
And in a nearby .t
file:
# This is a slow test not meant
# to run frequently.
use Test::Slow;
use Test::More;
It seems to work nicely.
P.S. Now available as Test::Slow on CPAN.