The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::TestCoverage - Test if your test covers all "public" subroutines of the package

VERSION

version 0.12

SYNOPSIS

  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');

DESCRIPTION

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.

"private" subroutines are defined as subroutines that names begin with _ like _private_sub{...} and "public" is the opposite.

subroutines

test_coverage $module

Tells Test::TestCoverage for what module the coverage should be tested

ok_test_coverage $module

Checks if all "public" subroutines of $module were called in the testscript

reset_test_coverage $module

Resets the counter for all method invokations of $module's subroutines.

reset_all_test_coverage

Resets the counter for all subroutines of all modules that were registerd via test_coverage.

test_coverage_except $module @subs

Test all "public" subroutines of $module except the subroutines named in the array.

all_test_coverage_ok

tests the test coverage for each registered module.

EXPORT

test_coverage, ok_test_coverage, reset_test_coverage, reset_all_test_coverage, test_coverage_except

SEE ALSO

Test::SubCalls, Test::Builder, Test::More, Devel::Cover

BUGS / TODO

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.

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Renee Baecker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)