Test::TestCoverage - Test if your test covers all "public" subroutines of the package
version 0.12
use Test::TestCoverage; test_coverage('My::Module'); my $obj = My::Module->new(); $obj->foo(); $obj->bar(); # test will be ok, assumed that My::Module has the subroutines new, foo and bar ok_test_coverage('My::Module'); reset_test_coverage('My::Module'); reset_all_test_coverage(); test_coverage('My::Module'); my $obj = My::Method->new(); $obj->foo(); # test will be not ok, because bar is not invoked ok_test_coverage('My::Module'); reset_test_coverage('My::Module'); reset_all_test_coverage(); test_coverage('My::Module'); test_coverage_except('My::Module','bar'); my $obj = My::Method->new(); $obj->foo(); # test will be ok, because bar is excepted of test ok_test_coverage('My::Module');
If a module is written, the tests cover just a few subroutines of the module. This module aims to support the author in writing "complete" tests. If one of the "public" subroutines are missed in the testscript, the test ok_test_coverage will fail.
ok_test_coverage
"private" subroutines are defined as subroutines that names begin with _ like _private_sub{...} and "public" is the opposite.
_
_private_sub{...}
Tells Test::TestCoverage for what module the coverage should be tested
Test::TestCoverage
Checks if all "public" subroutines of $module were called in the testscript
$module
Resets the counter for all method invokations of $module's subroutines.
Resets the counter for all subroutines of all modules that were registerd via test_coverage.
test_coverage
Test all "public" subroutines of $module except the subroutines named in the array.
tests the test coverage for each registered module.
test_coverage, ok_test_coverage, reset_test_coverage, reset_all_test_coverage, test_coverage_except
reset_test_coverage
reset_all_test_coverage
test_coverage_except
Test::SubCalls, Test::Builder, Test::More, Devel::Cover
There are a lot of things to do. If you experience any problems please contact me. At the moment the subroutines have to be invoked with full qualified names. Exported subroutines are not detected.
Renee Baecker <reneeb@cpan.org>
This software is Copyright (c) 2014 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Test::TestCoverage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::TestCoverage
CPAN shell
perl -MCPAN -e shell install Test::TestCoverage
For more information on module installation, please visit the detailed CPAN module installation guide.