Test::...Fixture(3pm)
πΈ Test::FITesque::Fixture β the perl manual page (3pm section) π
okay bestie, welcome to the base class of the FITesque universe β¨ this is a perl manual page, section 3pm, and it's about Test::FITesque::Fixture β the abstract-calls-for-fixtures queen π
β¨ NAME β¨
Test::FITesque::Fixture β abstract calls for fixtures. it's giving base class energy, no cap π«Ά
π 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);
}
see how cute that is? attributes on subs. periodt π
π¦ DESCRIPTION π¦
so basically this module is the base class for FITesque fixtures π it hands you the methods for the Test and Plan attributes, plus a couple of utility functions for Test::FITesque::Fixture. it's giving infrastructure, and we love her for it.
the one rule, and it's non-negotiable: every single method you want used as a FITesque test method must be marked with the Test attribute. no attribute, no test. that's the vibe check π
and the Plan attribute? it states how many Test::More functions the FITesque test method expects to run. if a method does not have the Plan attribute set, it's implied that the test method will execute one Test::More function. just one. a little single-serving test π
# 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, is a hook-in point so you can preprocess arguments headed for FITesque fixture test methods π this might be useful in case you want to design a domain specific language into your arguments. and by default? it just returns the arguments as is. no notes, no changes, straight through π§
π METHODS π
π« new
my $fixture = Buddha::Fixture->new();
simple constructor. she's simple, she's iconic, she shows up and does her job π
π« method_test_count
my $count = $fixture->method_test_count('foo');
this returns the planned test count associated with the passed method name. number go brrr, but like, accurately π
π« 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. attempts! it's trying its best π₯Ί
π« 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. pre-game for your args π₯
π AUTHORS π
Scott McWhirter, "<konobi@cpan.org>" β thank you for your service, legend π«‘
πΈ 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. read the license bestie, it's free and it's right there ππ
and that's the whole page!! this manual was brought to you by perl v5.34.0, dated 2022-07-04, and it lives in the Test::...Fixture(3pm) slot of your man pages π mwah, go write some fixtures, you got this π
π¦ where this page comes from
- debian bookworm: libtest-fitesque-perl 0.04-3 Β· BSD-3-Clause
- debian trixie: libtest-fitesque-perl 0.04-3 Β· BSD-3-Clause
- ubuntu noble: libtest-fitesque-perl 0.04-3 Β· BSD-3-Clause
- ubuntu resolute: libtest-fitesque-perl 0.04-3 Β· BSD-3-Clause
- ubuntu stonking: libtest-fitesque-perl 0.04-3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms