Ingy döt Net > Test-Common-0.07 > Test::Common

Download:
Test-Common-0.07.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.07   Source  

SYNOPSIS ^

From the command line:

    > test-common help
    > test-common config
    > edit t/common.yaml
    > test-common update

Optionally, in your Module::Install based Makefile.PL:

    use inc::Module::Install;
    ...
    # Keep common tests up to date
    test_common_update;

DESCRIPTION ^

There are many module unit tests that are either exactly the same or slightly different, from dist to dist. Test::Common is a framework for distributing and sharing these common tests. (The hope is...) By having many authors contribute to common test pools, not only will it be easier to write common tests fast, it will help expose where specific tests need to be written, and common ways to set these tests up.

As a module author, you maintain a configuration file called t/common.yaml, which contains information on all the common tests you want to use. These tests can come from Common::Test or any other module that distributes tests in the same way.

The common test scripts are files under the share/ directory. These files are actually Template Toolkit templates. Test::Common renders the templates into real test files (using data from t/common.yaml) every time you run the command test-common update.

CONFIGURATION ^

When you run:

    test-common config

you get an example t/common.yaml file. Edit it. There are comments inside exlaining the basics. For a given entry, like:

    - test: foo-bar.t

all the data in that hash gets passed to Template Toolkit to render the test's template. Simple.

To rename a test, do:

    - test: foo-bar.t
      name: test-foo-bar.t

EXTENDING ^

To create a package of your own common tests, put .t files into a share directory, so they get installed by make install, et al. Then other authors can add your test package to the 'sources' list of their t/common.yaml file.

COMMIT OR CLEAN? ^

Since Test::Common tests are always generated, it is your choice whether or not to commit the rendered tests. The only file you really ever need is t/common.yaml.

The config file has a clean setting that allows you to control what:

    common-tests clean

does. If you use the Module::Install plugin then you can just do:

    make clean
syntax highlighting: