Test::...Fixture(3pm)

πŸ“¦
version 0.04 Β· 2 versions
  • 0.04 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.04 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 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 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 πŸ’œ