1Test::Able::Runner(3) User Contributed Perl DocumentationTest::Able::Runner(3)
2
3
4

NAME

6       Test::Able::Runner - use Test::Able without a bunch of boilerplate
7

VERSION

9       version 1.002
10

SYNOPSIS

12         use Test::Able::Runner;
13
14         use_test_packages
15             -base_package => 'My::Project::Test';
16
17         run;
18

DESCRIPTION

20       I like Test::Able. I really don't like having to copy my boilerplate
21       test runner and modify it when I use it in a new project. This provides
22       a basic test runner for your testable tests that takes care of the
23       basics for you. You can extend it a bit to customize things if you like
24       as well. Let me know if you want this to do something else.
25
26       This mostly assumes that you want to run several tests as a group
27       within a single Perl interpreter. If this is not what you want, then
28       you probably don't want this module.
29

METHODS

31   use_test_packages
32       The first thing your test runner needs to do is call this method to
33       tell it what packages need to be included in your test.
34
35   COMMON CASES
36       Before describing the options, here are some examples of how to use
37       this subroutine.
38
39       EXAMPLE 1
40
41         use_test_packages
42             -base_package => 'My::Project::Test',
43             -test_path    => 't/lib';
44
45       This is pretty much the simplest case. This will load and run all the
46       packages starting with the name "My::Project::Test" found in the
47       project's t/lib directory. I show the "-test_path" option here, but in
48       this case it's redundant. Your test path is assumed to be t/lib in the
49       usual case.
50
51       EXAMPLE 2
52
53         use_test_packages
54             -test_packages => [ qw(
55                 My::Project::Test::One
56                 My::Project::Test::Two
57                 My::Project::Test::Three
58             ) ];
59
60       Rather than searching for any test packages you might have in your test
61       folder, you might prefer to explicitly list them.
62
63       OPTIONS
64
65       "-base_package"
66           This is the package namespace to search for classes within. Any
67           class found under this namespace (within any directory included in
68           "-test_path") will be run in your tests. If you want to include
69           classes under this base package namespace that are not tests (test
70           roles or base classes or whatever), you may place a global package
71           variable within the package named $NOT_A_TEST and set it to a true
72           value:
73
74             package My::Project::Test::Base;
75             use Test::Able;
76
77             our $NOT_A_TEST = 1;
78
79           You may use this option or the "-test_packages" option. This may be
80           a single scalar package name
81
82       "-test_packages"
83           This is the list of test packages to load and run. It is always
84           given as an array of package names.
85
86       "-test_path"
87           This is the search path for test classes. This lists additional
88           paths that should be added to @INC to search for tests before
89           loading the tests. These paths are added to the front of @INC.
90
91           It can be given as a single scalar or as an array of paths:
92
93             use_test_packages
94                 -base_package => 'My::Project::Test',
95                 -test_path    => [ 't/online', 't/offline' ];
96
97   init_meta
98       Sets up your test runner package.
99
100   run
101       This invokes the test runner for all the tests you've requested.
102

COOKBOOK

104       Here are some other things you might like to try.
105
106   Test Runner Tests
107       The test runner itself may have tests if you want. The test runner
108       classes uses the usual Test::Able bits, so this works. Similarly, you
109       can do setup, teardown, and all the rest in your runner.
110
111         use Test::Able::Runner;
112
113         use_test_packages
114             -base_package => 'Foo::Test';
115
116         test plan => 1, test_something => sub {
117             ok(1);
118         };
119
120         run;
121

AUTHOR

123       Andrew Sterling Hanenkamp "<hanenkamp@cpan.org>"
124
126       Copyright 2010 Qubling Software LLC.
127
128       This library is free software. You can redistribute it and/or modify it
129       under the same terms as Perl itself.
130
131
132
133perl v5.32.1                      2021-01-27             Test::Able::Runner(3)
Impressum