Speed up your tests.
Large Perl applications with many interconnected modules can take a long time to start up. Perl needs to load, compile, and initialize all of the modules before it can start running your application.
Tests for a large system can be particularly slow. A test suite typically contains lots of small short-lived scripts, each of which pulls in lots of module code at start up. A few seconds of delay per script can add up to a lot of time spent waiting for your test suite to finish.
The cure for long startup times within web-based applications is to run under a persistent environment such as mod_perl
PersistentPerl works for command-line programs as well. It's usually as simple as changing the shebang line from
Running your test suite persistently is slightly more complicated, and doesn't work for every test, but the benefit is a huge speed increase for most of your tests. Running your test suite persistently can speed up your tests by a factor of five on a slow machine.
The first step of the hack is to make
Test::Builder-based scripts compatible with PersistentPerl. There are several parts to this:
The script has to reset the
Test::Builder counter on startup.
The script needs to prevent
Test::Builder from duplicating
STDERR, as this seems to be incompatible with
no_plan have to register a
PersistentPerl cleanup handler to display ...