Duncan Ferguson
and 1 contributors


Test::NoPlan - check perl test files for 'no_plan'


It is a good idea to ensure you have defined how many tests should be run within each test script - to catch cases where tests bomb out part way through so you know how many tests were not actually run. This module checks all your test plan files to ensure 'no_plan' is not used.

You can check one file:

    use Test::NoPlan qw/ check_file_for_no_plan /;
    use Test::More tests => 1;

or check all files:

    use Test::NoPlan qw/ all_plans_ok /;


all_plans_ok({ options });

Searches for and checks *.t files within the current directory. Options (with defaults shown) are:

topdir => '.'

directory to begin search in - relative to the top directory in the project (i.e. where the Makefile.PL or Build.PL file is located)

check_files => qr/\.t$/xsm

Regexp used to identify files to check - i.e. files ending in '.t' - note, this just checks the basename of the files; the path is excluded.

ignore_files => qr/^\..*$/xsm

Regexp used to identify files to ignore - i.e. files starting with '.' - note, this just checks the basename of the files; the path is excluded.

recurse => 0

Recurse into any subdirectories - not done by default.

method => '<create|new>' [default: create]

Amend the method by which the test object is created. By default 'create' is used which is correct for tesst files containing only the 'all_plans_ok' test. If multiple tests are held within the same tesst file then 'new' should be used so a single test object is created and shared

get_file_list( { [ options ] } );

Return a list of files to be checked - uses same options as all_plans_ok

check_file_for_no_plan( $filename );

Check the given file for instances of uncommented 'no_plan' usage. Returns 0 for problem, 1 for no problem found.


Duncan Ferguson, < duncs@cpan.org >


Please report any bugs or feature requests to bug-test-noplan at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-NoPlan. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Test::NoPlan

You can also look for information at:



Copyright 2009 Duncan Ferguson, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.