Test::Able::Runner(3)
β¨ NAME β¨
Test::Able::Runner β use Test::Able without a bunch of boilerplate π
(okay bestie, this is the Test::Able::Runner(3) page from the User Contributed Perl Documentation, and we're about to make it make sense π
)
π VERSION π
version 1.002 β yeah she's been around, she's an icon, she's stable
π¦ SYNOPSIS π¦
use Test::Able::Runner;
use_test_packages
-base_package => 'My::Project::Test';
run;
that's it. that's the whole vibe. three little moves and you're running tests π
πΈ DESCRIPTION πΈ
so, like β the author loves Test::Able. genuinely. obsessed. π But what they do NOT love is copy-pasting their boilerplate test runner into every new project and then poking at it like "ugh what do I change this time". So this module exists: it gives you a basic test runner for your testable tests and handles all the basics for you. No cap. You can also extend it a lil bit to customize things if that's your thing. And hey β if you want it to do something else, just let them know fr.
Heads up though: this mostly assumes you wanna run several tests as a group inside a single Perl interpreter. If that's not what you want, then lowkey you probably don't want this module. vibe check failed, sorry bestie π
π METHODS π
π use_test_packages
First thing your test runner has to do: call this method so it knows which packages need to be included in your test. Literally step one, don't skip it.
π COMMON CASES
Before we get into the options, here's how people actually use this subroutine.
β¨ EXAMPLE 1
use_test_packages
-base_package => 'My::Project::Test',
-test_path => 't/lib';
This is pretty much the simplest case, bestie. It'll load and run every package starting with the name "My::Project::Test" found in the project's t/lib directory. Yes, the -test_path option is shown here, but in this case it's redundant β your test path is assumed to be t/lib in the usual case. She's just being thorough π
β¨ EXAMPLE 2
use_test_packages
-test_packages => [ qw(
My::Project::Test::One
My::Project::Test::Two
My::Project::Test::Three
) ];
Instead of searching for whatever test packages you might have chillin' in your test folder, you might prefer to just explicitly list them. main character energy: you decide who shows up. π«Ά
π OPTIONS π
-base_packageβ this is the package namespace to search for classes within. Any class found under this namespace (within any directory included in-test_path) will be run in your tests. Now: if you wanna include classes under this base package namespace that are not tests (test roles, base classes, whatever β they're valid, they just aren't tests), you can drop a global package variable inside the package named$NOT_A_TESTand set it to a true value:
package My::Project::Test::Base;
use Test::Able;
our $NOT_A_TEST = 1;
You may use this option or the -test_packages option. This may be a single scalar package name
-test_packagesβ this is the list of test packages to load and run. It is always given as an array of package names. no single scalars here, she wants the whole roster π-test_pathβ this is the search path for test classes. It lists additional paths that should be added to@INCto search for tests before loading the tests. These paths are added to the front of@INC. It can be given as a single scalar or as an array of paths:
use_test_packages
-base_package => 'My::Project::Test',
-test_path => [ 't/online', 't/offline' ];
π init_meta
Sets up your test runner package. that's the whole job. iconic, honestly β
π run
This invokes the test runner for all the tests you've requested. the moment we've all been waiting for π₯
π COOKBOOK π
Here are some other things you might like to try. little recipes, iykyk.
π§ Test Runner Tests
The test runner itself may have tests if you want. The test runner classes uses the usual Test::Able bits, so this works. Similarly, you can do setup, teardown, and all the rest in your runner. yes queen, the runner can have her own tests, we love a self-aware situation β¨
use Test::Able::Runner;
use_test_packages
-base_package => 'Foo::Test';
test plan => 1, test_something => sub {
ok(1);
};
run;
π AUTHOR π
Andrew Sterling Hanenkamp "<hanenkamp@cpan.org>"
π COPYRIGHT AND LICENSE π
Copyright 2010 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
okay and that's the whole page, bestie π₯° this was perl v5.42.0, dated 2025-07-25, and it's the Test::Able::Runner(3) page β go forth and run your tests as a group in one interpreter, no boilerplate, no stress, periodt π
π¦πΈ
π¦ where this page comes from
- fedora 43: perl-Test-Able-Runner 1.002-33.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms