DOKK / manpages / debian 12 / libtest-fitesque-perl / Test::FITesque::Fixture.3pm.en
Test::FITesque::Fixture(3pm) User Contributed Perl Documentation Test::FITesque::Fixture(3pm)

Test::FITesque::Fixture - Abstract calls for fixtures

  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);
  }

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 language into your arguments. By default, this method just returns the arguments as is.

  my $fixture = Buddha::Fixture->new();

Simple constructor

 my $count = $fixture->method_test_count('foo');

This returns the planned test count associated with the passed method name.

  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.

  my @arguments = $fixture->parse_arguments(qw(one two three));

This method provides a way to preprocess arguments for methods before they are run.

Scott McWhirter, "<konobi@cpan.org>"

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.

2022-07-04 perl v5.34.0