[Module-build-general] idea: ./Build cover, for test coverage testing
Status: Beta
Brought to you by:
kwilliams
|
From: Mark S. <ma...@su...> - 2003-09-28 20:08:06
|
You may be aware of Devel::Cover, a new module that with quality
assurance by reporting on how thoroughly a test suite is covering the
code in a Perl module.
However, I noticed that when I used the suggested syntax with a module
that used Module::Build, it generated an empty report. I tried this with
Data::FormValidator using the recommended syntax:
HARNESS_PERL_SWITCHES=-MDevel::Cover make test
cover -report html
I found this code from Richard Clamp on the web which allowed me to
use Devel::Cover with module build. It adds a new 'cover' target the Build
script:
sub ACTION_cover {
my $self = shift;
$self->depends_on('build');
system qw( cover -delete );
# sometimes we get failing tests, which makes Test::Harness
# die. catch that
eval {
local $ENV{PERL5OPT} = "-MDevel::Cover=-summary,0";
$self->ACTION_test(@_);
};
system qw( cover -report html );
}
####
This seems me like something that could eventually be suitable for the
core Module::Build. In the meantime, enjoy using the above code
to test your own module's test coverage.
Here are some real reports I generated with it:
Data::FormValidator
http://mark.stosberg.com/dfv/cover_db/cover_db.html
DBD::Pg
http://mark.stosberg.com/Tech/perl/dbd_pg/cover_db/cover_db.html
Mark
--
http://mark.stosberg.com/
|