Test::Module::Runnable - A runnable framework on Moose for running tests
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;
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.
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 return EXIT_SUCCESS in order for tests to proceed.
EXIT_FAILURE
EXIT_SUCCESS
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 return EXIT_SUCCESS. You can also perform final sanity checking here, because retuning EXIT_FAILURE causes the suite to call "BAIL_OUT" in Test::Builder.
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.
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.
To install Test::Module::Runnable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Module::Runnable
CPAN shell
perl -MCPAN -e shell install Test::Module::Runnable
For more information on module installation, please visit the detailed CPAN module installation guide.