NAME
ExtUtils::MakeMaker::Coverage - add a Makefile target to determine test coverage using Devel::Cover
VERSION
Version 0.05
SYNOPSIS
This module adds an additional target to the Makefile generated by ExtUtils::MakeMaker
. The target, testcover
, calls cover
, the command-line script to generate test coverage statistics, to clean up any data from a previous run. It then runs the tests, as if make test
was run, then calls cover
again to generate the coverage statistics.
# In Makefile.PL
use ExtUtils::MakeMaker;
use ExtUtils::MakeMaker::Coverage;
...
# if you already have a MY::postamble...
sub MY::postamble {
testcover();
...
}
# if you wish to tweak the testcover target that will be written,
# alter it's configuration.
$conf = ExtUtils::MakeMaker::Coverage->config;
In your shell
> perl Makefile.PL
> make
> make testcover
METHODS
testcover
This method is exported for use when there already is a MY::postamble in the Makefile.PL. In that case, adding a call to the testcover method will add the necessary Makefile steps.
config
This method returns the internal config object used by this package to create the testcover
target for the Makefile.
You can change parts of the testcover
target by setting accessors of this object
- binary
-
The value to use for the
cover
binary. Defaults tocover
. - format
-
The output format to use for
cover -report
. Defaults to none, usingcover
's default settings. Consultperldoc cover
for documentation on its-report
switch. - ignore
-
An array ref of patterns to ignore when generating the coverage report. Defaults to an empty list. Consult
perldoc cover
for documentation on its-ignore
switch. - files
-
An array ref of test files to run for this coverage reprort. Defaults to the
$(TESTFILES)
variable as defined in yourMakefile
. Consultperldoc ExtUtils::MakeMaker
for details. - cover_statement
-
Boolean indicating whether to run coverage on statements. Defaults to true. Consult
perldoc cover
for documentation on its-coverage
switch. - cover_branch
-
Boolean indicating whether to run coverage on branches. Defaults to true. Consult
perldoc cover
for documentation on its-coverage
switch. - cover_subroutine
-
Boolean indicating whether to run coverage on subroutines. Defaults to true. Consult
perldoc cover
for documentation on its-coverage
switch. - cover_condition
-
Boolean indicating whether to run coverage on conditions. Defaults to true. Consult
perldoc cover
for documentation on its-coverage
switch. - cover_pod
-
Boolean indicating whether to run coverage on POD. Defaults to true. Consult
perldoc cover
for documentation on its-coverage
switch.Example:
$config = ExtUtils::MakeMaker::Coverage->config; $config->pod(0); # disable pod coverage $config->files(['t/1.t', 't/2.t']); # use these test files only $config->ignore(['SCCS']); # ignore files with these # patterns in their path
NOTES
This is alpha quality code in terms of features. For this module to be usable for as many modules as possible, the following additional features are needed.
- BSD make
-
From my testing, if you run the testcover step using a BSD make, you will get coverage statistics for the test scripts. This is not at all useful. gmake is suggested until this issue is resolved.
- nmake
-
I have not tested this enough with nmake. I have done some initial changes to make it work, but it requires more refactoring to get to where I'd like to see it. Expect full support in a release or two.
AUTHOR
Steve Peters, <steve@fisharerojo.org>
BUGS
Please report any bugs or feature requests to bug-extutils-makemaker-coverage@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
- Paul Johnson
-
For developing
Devel::Cover
and enduring my many questions on IRC. - Andy Lester
-
For helping to make me a test-infected Perl programmer.
- Jos Boumans
-
For making many of the changes for the 0.05 release, including the testcover script.
SEE ALSO
COPYRIGHT & LICENSE
Copyright 2005 Steve Peters, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.