Apache-Test
view release on metacpan or search on metacpan
lib/Apache/TestMB.pm view on Meta::CPAN
=head2 Build
With the above script, users can build your module in the usual
C<Module::Build> way:
perl Build.PL
./Build
./Build test
./Build install
If C<Apache::TestMB> is installed, then Apache will be started before
tests are run by the C<test> action, and shut down when the tests
complete. Note that C<Build.PL> can be called C<Apache::Test>-specific
options in addition to the usual C<Module::Build> options. For
example:
perl Build.PL -apxs /usr/local/apache/bin/apxs
Consult the L<Apache::Test|Apache::Test> documentation for a complete
list of options.
In addition to the actions provided by C<Module::Build> (C<build>,
C<clean>, C<code>, C<test>, etc.), C<Apache::TestMB> adds a few extra
actions:
=over 4
=item test_clean
This action cleans out the files generated by the test script,
F<t/TEST>. It is also executed by the C<clean> action.
=item run_tests
This action actually the tests by executing the test script,
F<t/TEST>. It is executed by the C<test> action, so most of the time
it won't be executed directly.
=item testcover
C<Apache::TestMB> overrides this action from C<Module::Build> in order to
prevent the C<Apache::Test> preference files from being included in the test
coverage.
=back
=head2 Constructor
=head3 new
The C<new()> constructor takes all the same arguments as its parent in
C<Module::Build>, but can optionally accept one other parameter:
=over
=item apache_test_script
The name of the C<Apache::Test> test script. The default value is
F<t/TEST>, which will work in the vast majority of cases. If you wish
to specify your own file name, do so with a relative file name using
Unix-style paths; the file name will automatically be converted for
the local platform.
=back
When C<new()> is called it does the following:
=over 4
=item *
Processes the C<Apache::Test>-specific options in C<@ARGV>. See the
L<Apache::Test|Apache::Test> documentation for a complete list of
options.
=item *
Sets the name of the C<Apache::Test> test script to F<t/TEST>, unless
it was explicitly specified by the C<apache_test_script> parameter.
=item *
Calls C<generate_script()> to generate C<Apache::Test> test script,
usually F<t/TEST>.
=back
=head2 Instance Methods
=head3 apache_test_args
Returns a hash reference containing all of the settings specified by
options passed to F<Build.PL>, or explicitly added to C<@ARGV> in
F<Build.PL>. Consult the L<Apache::Test|Apache::Test> documentation
for a complete list of options.
=head3 apache_test_script
Gets or sets the file name of the C<Apache::Test> test script.
=head3 generate_script
$build->generate_script;
$build->generate_script('t/FOO');
$build->generate_script(undef, 'Apache::TestRun');
This method is called by C<new()>, so in most cases it can be
ignored. If you'd like it to use other than the default arguments, you
can call it explicitly in F<Build.PL> and pass it the arguments you
desire. It takes two optional arguments:
=over 4
=item *
The name of the C<Apache::Test> test script. Defaults to the value
returned by C<apache_test_script()>.
=item *
The name of an C<Apache::Test> test running class. Defaults to
( run in 1.467 second using v1.01-cache-2.11-cpan-39bf76dae61 )