NAME
Test::Able - xUnit with Moose
VERSION
0.04
SYNOPSIS
package MyTest;
use Test::Able;
use Test::More;
startup some_startup => sub { ... };
setup some_setup => sub { ... };
test plan => 1, foo => sub { ok( 1 ); };
test plan => 42, bar => sub { ok( 1 ) for 1 .. 42; };
teardown some_teardown => sub { ... };
shutdown some_shutdown => sub { ... };
package main;
use MyTest;
MyTest->new->run_tests;
DESCRIPTION
An xUnit style testing framework inspired by Test::Class and built using Moose. It can do all the important things Test::Class can do and more. The prime advantages of using this module instead of Test::Class are flexibility and power. Namely, Moose.
This module was created for a few of reasons:
To address perceived limitations in, and downfalls of, Test::Class.
To leverage existing Moose expertise for testing.
To bring Moose to the Perl testing game.
The core code and documentation are in Test::Able::Role::Meta::Class.
EXPORTED FUNCTIONS
In addition to exporting for Moose, Test::Able will export a handful of functions that can be used to declare test-related methods.
- startup/setup/test/teardown/shutdown
-
A more Moose-like way to do method declaration. The syntax is similar to "has" in Moose except its for test-related methods.
These start with one of startup/setup/test/teardown/shutdown depending on what type of method you are defining. Then comes any attribute name/value pairs to set in the Test::Able::Method object. The last pair must always be the method name and the coderef. This is to disambiguate between the method name/code pair and another attribute in Test::Able::Method that happens to take a coderef. Here are some examples:
setup some_setup_method => sub { ... }; test do_setup => 0, do_teardown => 0, some_test_method => sub { ... }; shutdown foo => sub { ... }, bar => undef => baz => 42, some_shutdown_method => sub { ... };
AUTHOR
Justin DeVuyst, justin@devuyst.com
COPYRIGHT AND LICENSE
Copyright 2009 by Justin DeVuyst.
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.