++ed by:
KAORU ARJONES RRWO TOSHIOITO OVID

5 PAUSE users
2 non-PAUSE users.

Curtis "Ovid" Poe

NAME

Test::Kit - Build custom test packages with only the features you want.

VERSION

Version 0.100

SYNOPSIS

    package My::Custom::Tests;

    use Test::Kit
        'Test::More',
        'Test::XML',
        'Test::Differences',
        '+explain',
    );

DESCRIPTION

Build custom test modules, using other test modules for parts.

  • kit:

        A set of materials or parts from which something can be assembled.

How many times have you opened up a test program in a large test suite and seen 5 or 6 use Test::... lines? And then you open up a bunch of other test programs and they all have the same 5 or 6 lines. That's duplication you don't want. Test::Kit allows you to safely push that code into one custom test package and merely use that package. It does this by treating various test module's functions as pieces you can assemble together.

Also, you can import 'features' to extend your testing possibilities.

USAGE

Basic

Create a package for your tests and add the test modules you want.

     package My::Tests;

     use Test::Kit qw(
         Test::Differences
         Test::Exception
     );

Then in your test programs, all exported test functions from those modules will be available. Test::More functions are included by default. If you add 'Test::Most' to your Test::Kit import list, it will take precedence over Test::More.

    use My::Tests plan => 3;

    is 3, 3, 'this if from Test::More';
    eq_or_diff [ 3, 3 ], [ 3, 3 ], 'this is from Test::Differences';
    throws_ok { die 'test message' }
        qr/^test message/,
        '... and this is from Test::Exception';

Using "Features"

Additional features, as detailed in Test::Kit::Features, are available. Two common features are 'explain' and 'on_fail'. To use a feature, just add a '+' (plus) before the feature name:

     package My::Tests;

     use Test::Kit qw(
         Test::Differences
         Test::Exception
         Test::XML
         Test::JSON
         +explain
         +on_fail
     );

Advanced usage

Sometimes two or more test modules may try to export a function with the same name. This will cause a compile time failure listing which modules export which conflicting function. There are two ways of dealing with this: renaming and excluding. To do this, add a hashref after the module name with keys 'exclude', 'rename', or both.

    use Test::Most 
        'Test::Something' => {
            # or a scalar for just one
            exclude => [qw/ list of excluded functions/],
        },
        'Test::Something::Else' => {
            # takes a hashref
            rename => {
                old_test_function_name => 'new_test_function_name',
            },
        },
        '+explain';

AUTHOR

Curtis "Ovid" Poe, <ovid at cpan.org>

BUGS

Please report any bugs or feature requests to bug-test-kit at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Kit. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Test::Kit

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2008 Curtis "Ovid" Poe, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.