NAME
Test::FITesque::Fixture - Abstract calls for fixtures
SYNOPSIS
package Buddha::Fixture;
use strict;
use warnings;
use base qw(Test::FITesque::Fixture);
use Test::More qw();
sub click_on_button : Test {
my ($self, @args) = @_;
...
ok(1);
}
sub open_window : Test : Plan(3) {
my ($self, @args) = @_;
...
ok(1);
ok(2);
ok(3);
}
DESCRIPTION
This module provides the base class for FITesque fixtures. It provides methods for the 'Test' and 'Plan' attributes along with some utility functions for Test::FITesque::Fixture.
All methods for use as FITesque test methods must be marked with the 'Test' attribute.
The 'Plan' attribute states how many Test::More functions the FITesque test method expects to run. If a method does not have the 'Plan' attribute set, it is implied that the test method will execute one Test::More functions.
# Execute 10 Test::More functions
sub test_method : Test : Plan(10) {
...
}
# Just one this time
sub test_method : Test {
...
}
# not a test method
sub normal_method {
...
}
There are also 2 methods which may require overriding. The parse_method_string method returns a coderef of the method that relates to the method string used as the first element of a FITesque test row.
# get coderef for the 'click_on_buton' method of the fixture class
my $coderef = $fixture->parse_method_string('click on button');
The other method, 'parse_arguments' provides a hook in point to allow preprocessing on arguments to FITesque fixture test methods. This might be useful in case you want to design a domain specific langauge into your arguments. By default, this method just returns the arguments as is.
METHODS
new
my $fixture = Buddha::Fixture->new();
Simple constructor
method_test_count
my $count = $fixture->method_test_count('foo');
This returns the planned test count associated with the passed method name.
parse_method_string
my $coderef = $fixture->parse_method_string('click on button');
This method takes a string of text and attempts to return a coderef of a method within the fixture class.
parse_arguments
my @arguments = $fixture->parse_arguments(qw(one two three));
This method provides a way to preprocess arguments for methods before they are run.
AUTHORS
Scott McWhirter, <konobi@cpan.org>
COPYRIGHT & LICENSE
Copyright 2007 Scott McWhirter, all rights reserved.
This program is released under the following license: BSD. Please see the LICENSE file included in this distribution for details.