The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

runtests - Run tests through a TAPx harness.

USAGE

 runtests [options] [files or directories]

OPTIONS

Boolean options

 -v,  --verbose     Print all test lines.
 -l,  --lib         Add 'lib' to the path for your tests.
 -b,  --blib        Add 'blib/lib' to the path for your tests.
 -s,  --shuffle     Run the tests in random order.
 -c,  --color       Color test output.  See TAPx::Harness::Color.
 -f,  --failures    Only show failed tests.
 -r,  --recurse     Recursively descend into directories.
 -q,  --quiet       Suppress some test output while running tests.
 -q,  --QUIET       Only print summary results.
 -p,  --parse       Show full list of TAP parse errors, if any.
 -T                 Enable tainting checks.
 -t                 Enable tainting warnings.
 -W                 Enable fatal warnings.
 -w                 Enable warnings.

Options which take arguments

 -h,  --harness     Define test harness to use.  See TAPx::Harness.
 -e,  --exec        Program to run the tests with.
      --execrc      Location of 'execrc' file (no short form)

Reading from STDIN

If you have a list of tests (or URLs, or anything else you want to test) in a file, you can add them to your tests by using a '-':

 runtests - < my_list_of_things_to_test.txt

See the README in the examples directory of this distribution.

NOTES

Default Test Directory

If no files or directories are supplied, runtests looks for all files matching the pattern t/*.t.

Colored Test Output

Specifying the --color or -c switch is the same as:

 runtests --harness TAPx::Harness::Color

Note that this only has an effect if the --verbose or --failures options are set.

--exec

Normally you can just pass a list of Perl tests and the harness will know how to execute them. However, if your tests are not written in Perl or if you want all tests invoked exactly the same way, use the -e, or --exec switch:

 runtests --exec '/usr/bin/ruby -w' t/
 runtests --exec '/usr/bin/perl -Tw -mstrict -Ilib' t/

--execrc

Location of 'execrc' file. See TAPx::Harness for more information.

PERFORMANCE

Because of its design, TAPx::Parser collects more information than Test::Harness. However, the trade-off is performance. Using runtests is often slower than the prove utility which is bundled with Test::Harness. For small tests suites, this is usually not a problem. However, enabling the --quiet or --QUIET options can speed up the test suite considerably. In fact, with the --QUIET option, test suites often run faster than with prove.

Use of the --exec switch, even with Perl tests, can provide a huge performance boost and the tests will almost certainly run faster than Test::Harness/prove. This is because if this switch is not supplied, the harness must try to open the file and examine its shebang line, determine how it's to be invoked, and with which switches. Thus, every file is opened twice. With --exec, you only need to open each file once, thus saving a lot of I/O.

CAVEATS

This is alpha code. You've been warned.