1Apache::TestMB(3)     User Contributed Perl Documentation    Apache::TestMB(3)
2
3
4

NAME

6       Apache::TestMB - Subclass of Module::Build to support Apache::Test
7

SYNOPSIS

9       Standard process for building & installing modules:
10
11         perl Build.PL
12         ./Build
13         ./Build test
14         ./Build install
15
16       Or, if you're on a platform (like DOS or Windows) that doesn't like the
17       "./" notation, you can do this:
18
19         perl Build.PL
20         perl Build
21         perl Build test
22         perl Build install
23

DESCRIPTION

25       This class subclasses "Module::Build" to add support for testing Apache
26       integration with Apache::Test. It is broadly based on "Apache::TestMM",
27       and as such adds a number of build actions to a the Build script, while
28       simplifying the process of creating Build.PL scripts.
29
30       Here's how to use "Apache::TestMB" in a Build.PL script:
31
32         use Module::Build;
33
34         my $build_pkg = eval { require Apache::TestMB }
35             ? 'Apache::TestMB' : 'Module::Build';
36
37         my $build = $build_pkg->new(
38             module_name => 'My::Module',
39         );
40         $build->create_build_script;
41
42       This is identical to how "Module::Build" is used. Not all target
43       systems may have "Apache::Test" (and therefore "Apache::TestMB"
44       installed, so we test for it to be installed, first. But otherwise, its
45       use can be exactly the same. Consult the Module::Build documentation
46       for more information on how to use it; Module::Build::Cookbook may be
47       especially useful for those looking to migrate from
48       "ExtUtils::MakeMaker".
49

INTERFACE

51   Build
52       With the above script, users can build your module in the usual
53       "Module::Build" way:
54
55         perl Build.PL
56         ./Build
57         ./Build test
58         ./Build install
59
60       If "Apache::TestMB" is installed, then Apache will be started before
61       tests are run by the "test" action, and shut down when the tests
62       complete. Note that "Build.PL" can be called "Apache::Test"-specific
63       options in addition to the usual "Module::Build" options. For example:
64
65         perl Build.PL -apxs /usr/local/apache/bin/apxs
66
67       Consult the Apache::Test documentation for a complete list of options.
68
69       In addition to the actions provided by "Module::Build" ("build",
70       "clean", "code", "test", etc.), "Apache::TestMB" adds a few extra
71       actions:
72
73       test_clean
74           This action cleans out the files generated by the test script,
75           t/TEST. It is also executed by the "clean" action.
76
77       run_tests
78           This action actually the tests by executing the test script,
79           t/TEST. It is executed by the "test" action, so most of the time it
80           won't be executed directly.
81
82       testcover
83           "Apache::TestMB" overrides this action from "Module::Build" in
84           order to prevent the "Apache::Test" preference files from being
85           included in the test coverage.
86
87   Constructor
88       new
89
90       The "new()" constructor takes all the same arguments as its parent in
91       "Module::Build", but can optionally accept one other parameter:
92
93       apache_test_script
94           The name of the "Apache::Test" test script. The default value is
95           t/TEST, which will work in the vast majority of cases. If you wish
96           to specify your own file name, do so with a relative file name
97           using Unix-style paths; the file name will automatically be
98           converted for the local platform.
99
100       When "new()" is called it does the following:
101
102       ·   Processes the "Apache::Test"-specific options in @ARGV. See the
103           Apache::Test documentation for a complete list of options.
104
105       ·   Sets the name of the "Apache::Test" test script to t/TEST, unless
106           it was explicitly specified by the "apache_test_script" parameter.
107
108       ·   Calls "generate_script()" to generate "Apache::Test" test script,
109           usually t/TEST.
110
111   Instance Methods
112       apache_test_args
113
114       Returns a hash reference containing all of the settings specified by
115       options passed to Build.PL, or explicitly added to @ARGV in Build.PL.
116       Consult the Apache::Test documentation for a complete list of options.
117
118       apache_test_script
119
120       Gets or sets the file name of the "Apache::Test" test script.
121
122       generate_script
123
124         $build->generate_script;
125         $build->generate_script('t/FOO');
126         $build->generate_script(undef, 'Apache::TestRun');
127
128       This method is called by "new()", so in most cases it can be ignored.
129       If you'd like it to use other than the default arguments, you can call
130       it explicitly in Build.PL and pass it the arguments you desire. It
131       takes two optional arguments:
132
133       ·   The name of the "Apache::Test" test script. Defaults to the value
134           returned by "apache_test_script()".
135
136       ·   The name of an "Apache::Test" test running class. Defaults to
137           "Apache::TestRunPerl".
138
139       If there is an existing t/TEST.PL (or a script with the same name as
140       specified by the "apache_test_script" parameter but with .PL appended
141       to it), then that script will be used as the template for the test
142       script.  Otherwise, a simple test script will be written similar to
143       what would be written by "Apache::TestRun::generate_script()" (although
144       that function is not aware of the arguments passed to Build.PL, so use
145       this one instead!).
146

SEE ALSO

148       Apache::TestRequest
149           Demonstrates how to write tests to send requests to the Apache
150           server run by "./Build test".
151
152       Module::Build
153           The parent class for "Apache::TestMB"; consult it's documentation
154           for more on its interface.
155
156       <http://www.perl.com/pub/a/2003/05/22/testing.html>
157           This article by Geoffrey Young explains how to configure Apache and
158           write tests for your module using Apache::Test. Just use
159           "Apache::TestMB" instead of "Apache::TestMM" to update it for use
160           with "Module::Build".
161

AUTHOR

163       David Wheeler
164
165       Questions can be asked at the test-dev <at> httpd.apache.org list. For
166       more information see: http://httpd.apache.org/test/ and
167       http://perl.apache.org/docs/general/testing/testing.html.
168
169
170
171perl v5.30.0                      2019-10-07                 Apache::TestMB(3)
Impressum