NAME
Test::Module::Runnable - A runnable framework on Moose for running tests
SYNOPSIS
package YourTestSuite;
use Moose;
use Test::More 0.96;
extends 'Test::Module::Runnable';
sub helper { } # Not called
sub testExample { } # Automagically called due to 'test' prefix.
package main;
my $tester = new YourTestSuite;
plan tests => $tester->testCount;
foreach my $name ($tester->testMethods) {
subtest $name => $tester->$name;
}
alternatively...
my $tester = new YourTestSuite;
return $tester->run;
DESCRIPTION
A test framework based on Moose introspection to automagically call all methods matching a user-defined pattern. Supports per-test setup and tear-down routines and easy early "BAIL_OUT" in Test::Builder using Test::More.
USER DEFINED METHODS
setUpBeforeClass
-
If you need to initialize your test suite before any tests run, this hook is your opportunity. If the setup fails, you should return
EXIT_FAILURE
. you must returnEXIT_SUCCESS
in order for tests to proceed.Don't write code here! Override the method in your test class.
The default action is to do nothing.
tearDownAfterClass
-
If you need to finalize any cleanup for your test suite, after all tests have completed running, this hook is your opportunity. If the cleanup fails, you should return
EXIT_FAILURE
. If cleanup succeeds, you should returnEXIT_SUCCESS
. You can also perform final sanity checking here, because retuningEXIT_FAILURE
causes the suite to call "BAIL_OUT" in Test::Builder.Don't write code here! Override the method in your test class.
The default action is to do nothing.
setUp
-
If you need to perform per-test setup, ie. before individual test methods run, you should override this hook. You must return
EXIT_SUCCESS
from the hook, otherwise the entire test suite will be aborted via "BAIL_OUT" in Test::Builder.Don't write code here! Override the method in your test class.
The default action is to do nothing.
tearDown
-
If you need to perform per-test cleanup, ie. after individual test methods run, you should override this hook. You must return
EXIT_SUCCESS
from the hook, otherwise the entire test suite will be aborted via "BAIL_OUT" in Test::Builder.Don't write code here! Override the method in your test class.
The default action is to do nothing.