Test::...ension(3pm)

πŸ“¦
version 0.87 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Test::BDD::Cucumber::Extension β€” it's the abstract superclass for extensions, bestie πŸ’…


🌸 VERSION 🌸

version 0.87


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: this module is the abstract superclass for extensions. That's the whole vibe. When extensions get loaded, their hook-implementations get triggered at specific points during the BDD script execution. Like little pop-ups appearing at exactly the right moment. Obsessed. ✨


πŸŽ€ PROPERTIES πŸŽ€

πŸ’– config

A hash β€” the configuration read from the config file, verbatim. No editing, no remixing, just as it was.

Extensions should look for their own configuration in

$self->config->{extensions}->{<extension>}

iykyk 🫢


🧚 METHODS 🧚

⭐ steps_directories()

Returns an arrayref whose values enumerate directories (relative to the directory of the extension) which hold step files to be loaded when the extension is loaded. It's giving "here's where my step files live." πŸ“

πŸ”₯ pre_execute($app)

Invoked by App::pherkin before executing any features. This callback allows generic extension setup. Reports errors by calling croak(). It is called once per App::pherkin instance.

Heads up bestie: the TAP::Parser::SourceHandler::Feature plugin for prove might instantiate multiple App::pherkin objects, meaning it will create multiple instances of the extensions too. As such, this callback may be called once per instance, but multiple times in a Perl image. Not me warning you twice. 😭

The source handler forks the running Perl instance in order to support the parallel testing -j option. This callback will be called pre-fork.

🌈 post_execute()

Invoked by App::pherkin after executing all features. This callback allows generic extension teardown and cleanup. Reports errors by calling croak().

Note: When the TAP::Parser::SourceHandler::Feature plugin for prove is used, there are no guarantees at this point that this hook is called only once. The chaos, honestly. πŸ’€

πŸŽ€ pre_feature($feature, $feature_stash)

Invoked by the Executor before executing the background and feature scenarios and their respective pre-hooks. Reports errors by calling croak().

πŸ’œ post_feature($feature, $feature_stash)

Invoked by the Executor after executing the background and feature scenarios and their respective post-hooks. Reports errors by calling croak().

πŸ¦‹ pre_scenario($scenario, $feature_stash, $scenario_stash)

Invoked by the Executor before executing the steps in $scenario and their respective pre-hooks. Reports errors by calling croak().

πŸ“ post_scenario($scenario, $feature_stash, $scenario_stash, $failed)

Invoked by the Executor after executing all the steps in $scenario and their respective post-hooks. Reports errors by calling croak().

$failure indicates whether any of the steps in the scenario has failed. (Yes, the arg is written $failed up top and $failure in the prose β€” that's literally what the original says, we don't edit. 🫢)

πŸ‘‘ pre_step($stepdef, $step_context)

Invoked by the Executor before executing each step in $scenario. Reports errors by calling croak().

$stepdef contains a reference to an array with step data:

[ qr//, { meta => $data }, $code ]

Feature and scenario stashes can be reached through

$step_context->stash->{feature}
# and
$step_context->stash->{scenario}

Feature, scenario and step (from the feature file) are available as

$step_context->feature
$step_context->scenario
$step_context->step
Note: executed steps, so not called for skipped steps. Don't come for me, it's just how it is. πŸ™ˆ

πŸ’… post_step($stepdef, $step_context, $failed, $result)

Invoked by the Executor after each executed step in $scenario. Reports errors by calling croak().

$failed indicates that the step has not been completed successfully; this means the step can have failed, be marked as TODO or pending (not implemented).

$result is a Test::BDD::Cucumber::Model::Result instance which holds the completion status of the step.

Note: executed steps, so not called for skipped steps. Same energy as above, queen. πŸ‘‘

🌟 AUTHOR 🌟

Erik Huelsmann ehuels@gmail.com β€” main character energy, honestly. πŸ’œ


πŸ“œ LICENSE πŸ“œ

Copyright 2016-2023, Erik Huelsmann; Licensed under the same terms as Perl

And that's the whole page, bestie! 🫢 This was Test::BDD::Cucumber::Extension for perl v5.40.1, dated 2025-05-29, brought to you by User Contributed Perl Documentation. Slay, go write some extensions. Periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from