NAME

Fennec - A more modern testing framework for perl

DESCRIPTION

Fennec 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 Fennec::Specification for more details.

WHY FENNEC

Fennec is intended to do for perl testing what Moose does for OOP. It makes all tests classes, and defining test cases and test sets within that class is simple. In traditional perl testing you would have to manually loop if you wanted to runa set of tests multiple times in different cases, it is difficult to make forking tests, and you have limited options for more advanced test frameworks.

Fennec runs around taking care of the details for you. You simply need to specify your sets, your cases, and weither or not you want the sets and cases to fork, run in parrallel or in sequence. Test sets and cases are run in random order by default. Forking should just plain work without worrying about the details.

The Fennec fox is a hyper creature, it does a lot of running around, because of this the name fits. As well Fennec is similar in idea to Moose, so why not name it after another animal? Finally I already owned the namespace for a dead project, and the namespace I wanted was taken.

EARLY VERSION WARNING

This is VERY early version. Fennec does not run yet.

Please go to http://github.com/exodist/Fennec to see the latest and greatest.

DOCUMENTATION

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

IMPORT

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

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

IMPORT OPTIONS

use Fennec %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 Fennec testing => 'My::Module';
import_args => [ @ARGS ]

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

use Fennec 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 Fennec::Plugin for more information about plugins.

See Also Fennec::Plugin::Simple, Fennec::Plugin::More, Fennec::Plugin::Exception, Fennec::Plugin::Warn

all others

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

CONSTRUCTORS

$ts = $class->new()

Takes no arguments. Returns the Fennec 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 <Fennec::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 Fennec 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 Fennec::Plugin or the PLUGINS section of Fennec::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

Fennec is free software; Standard perl licence.

Fennec 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.