Test::Able::Runner(3)

πŸ“¦
version 1.002 Β· 2 versions
, in fedora 43

✨ 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_TEST and 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 @INC to 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 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