NAME

Test::Suite - A more modern testing framework for perl

DESCRIPTION

Test-Suite is a test framework that addresses several complains I have heard, or have myself issued forth about perl testing. It is still based off Test::Builder and uses a lot of existing test tools.

Please see Test::Suite::Specification for more details.

EARLY VERSION WARNING

This is VERY early version. Test::Suite does not run yet.

Please go to http://github.com/exodist/Test-Suite to see the latest and greatest.

DOCUMENTATION

This is the internal Test::Suite API documentation. For more detailed end-user documentation please see Test::Suite::Manual.

IMPORT

Test::Suite is the only module someone using Test::Suite should have to 'use'. The parameters provided to import() on use do a significant portion of the test setup. When Test::Suite is used it will instantate a singleton of the calling class and store it as a test to be run.

Using Test::Suite also automatically adds 'Test::Suite::TestBase' to the calling classes @ISA.

IMPORT OPTIONS

use Test::Suite %OPTIONS;

These are the options supported, all are optional.

testing => 'My::Module'

Used to specify the module to be tested by this test class. This module will be loaded, and it's import will be run with the test class as caller. This is a lot like use_ok(), the difference is that 'use' forces a BEGIN{} block.

Anything exported by the tested module will be loaded before the rest of the test class is compiled. This allows the use of exported functions with prototypes and the use of constants within the test class.

use Test::Suite testing => 'My::Module';
import_args => [ @ARGS ]

Specify the arguments to provide the import() method of the module specified by 'testing => ...'.

use Test::Suite testing     => 'My::Module',
                import_args => [ 'a', 'b' ];
plugins => [ 'want', 'another', '-do_not_want', '-this_either' ]

Specify which plugins to load or prevent loading. By default 'More', 'Simple', 'Exception', and 'Warn' plugins are loaded. You may specify any additional plugins. You may also prevent the loadign of a default plugin by listing it prefixed by a '-'.

See Test::Suite::Plugin for more information about plugins.

See Also Test::Suite::Plugin::Simple, Test::Suite::Plugin::More, Test::Suite::Plugin::Exception, Test::Suite::Plugin::Warn

all others

All other arguments will be passed into the constructor for your test class, which is defined in Test::Suite::TestBase.

CONSTRUCTORS

$ts = $class->new()

Takes no arguments. Returns the Test::Suite singleton object.

$ts = $class->get()

Aloas to new, as a singleton get() makes more sense in many cases.

OBJECT METHODS

$ts->add_test( $test )

Add a <Test::Suite::TestBase> object to be tested when run is called.

$test = $ts->get_test( $package )

Get the singleton test for the specified package.

$tests = $ts->tests

Get the hashref storing all the package => $test relationships.

$pid = $ts->pid()

Returns the current process id as provided by $$.

$pid = $ts->parent_pid()

Returns the pid of the process which instantiated the Test::Suite singleton.

$bool = $ts->is_parent()

Returns true if the current process is the process in which the singleton was instantiated.

$bool = $ts->is_running()

Check if the tests are currently running.

$ts->result({ result => $BOOL, name => 'My Test', ... })

Issue a test result for output. You almost certainly do not want to call this directly. If you are witing a plugin please see Test::Suite::Plugin or the PLUGINS section of Test::Suite::Manual.

$ts->diag( "message 1", "message 2", ... )

An interface to Test::Builder->diag() (which has been overriden). You can use this to report diagnostics information.

$ts->run()

Run the tests. Will die if they are already running, or if the process is ntot he parent.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum

Test-Suite is free software; Standard perl licence.

Test-Suite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.