Test::...xecutor(3pm)
β¨ Test::BDD::Cucumber::Executor π
okay bestie, so this whole thing lives in the User Contributed Perl Documentation corner of the world (the module name is Test::BDD::Cucumber::Executor, and yeah the manpage header squishes it into Test::...xecutor(3pm) because terminals are dramatic like that).
πΈ NAME πΈ
Test::BDD::Cucumber::Executor β Run through Feature and Harness objects π¦
π VERSION π
version 0.87 β yes ma'am, we're on 0.87 β¨
π DESCRIPTION π
So the Executor is the main character here. It runs through your Features, matches up the Step Lines with the Step Definitions (the way that it just knows which step goes with which line, obsessed), and reports on all the progress through the harness you hand it. Fr fr, that's the whole vibe.
π ATTRIBUTES π
π matching
This attribute should be one of "first" (the default, bestie), "relaxed", or "strict".
- By default (
"first"), the first matching step is executed immediately, and the search for (further) matching steps is terminated right then and there. Done. Periodt. π - When
matchingis set to anything other than"first", all steps get checked for matches. - When it's set to
"relaxed", a warning will be generated if you've got multiple matches. π¬ - When it's set to
"strict", an exception will be thrown on multiple matches. No cap, it will absolutely throw hands. π
π₯ METHODS π₯
π extensions
π add_extensions
The extensions attribute is an arrayref of Test::BDD::Cucumber::Extension extensions. These Extensions have their hook-functions called by the Executor at specific points in the BDD feature execution. πͺ
add_extensions adds items in FIFO using unshift(), and they're called in reverse order at the end hook. Which means if you do:
add_extensions( 1 );
add_extensions( 2, 3 );
then the pre_* will be called in order 2, 3, 1, and the post_* will be called in 1, 3, 2. It's giving stack energy, iykyk. π₯
π¦ steps
π¦ add_steps
The steps attribute is a hashref of arrayrefs, storing steps by their Verb. add_steps() takes step definitions of the item list form:
(
[ Given => qr//, sub {} ],
),
Or, when metadata is specified with the step, of the form:
(
[ Given => qr//, { meta => $data }, sub {} ]
),
(where the hashref stores step metadata) β and it populates steps with them. Simple as that. β¨
π execute
Execute accepts a feature object, a harness object, and an optional Cucumber::TagExpressions::ExpressionNode object. Then, for each scenario in the feature which meets the tag requirements (or all of them, if you haven't specified one), it runs execute_scenario. Slay. π
πΈ execute_outline
Accepts a hashref of options and executes each scenario definition in the scenario outline β or, lacking an outline, it just executes the single defined scenario. Either way, we move. π«Ά
Options:
" feature "β ATest::BDD::Cucumber::Model::Featureobject" feature_stash "β A hashref that should live the lifetime of feature execution" harness "β ATest::BDD::Cucumber::Harnesssubclass object" outline "β ATest::BDD::Cucumber::Model::Scenarioobject" background "β An optionalTest::BDD::Cucumber::Model::Scenarioobject representing the Background
π execute_scenario
Accepts a hashref of options, and executes each step in a scenario. Options:
"feature"β ATest::BDD::Cucumber::Model::Featureobject"feature_stash"β A hashref that should live the lifetime of feature execution"harness"β ATest::BDD::Cucumber::Harnesssubclass object"scenario"β ATest::BDD::Cucumber::Model::Scenarioobject"background_obj"β An optionalTest::BDD::Cucumber::Model::Scenarioobject representing the Background"scenario_stash"β A hashref that lives the lifetime of the scenario execution
For each step, a Test::BDD::Cucumber::StepContext object is created and passed to dispatch(). Nothing is returned β everything is played back through the Harness interface. It's giving theatrical, honestly. π
π§ add_placeholders
Accepts a text string and a hashref, and replaces <placeholders> with the values in the hashref, returning a string. Glow-up for your text, bestie. β¨
π§ add_table_placeholders
Accepts a hash with parsed table data and a hashref, and replaces <placeholders> with the values in the hashref, returning a copy of the parsed table hashref. (Copy!! We don't mutate the original in this house.) π
π find_and_dispatch
Accepts a Test::BDD::Cucumber::StepContext object, and searches through the steps that have been added to the executor object, executing against the first matching one β unless $self->matching indicates otherwise. π
You can also pass in a boolean 'short-circuit' flag if the Scenario's remaining steps should be skipped, and a boolean flag to denote if it's a redispatched step. Two flags, one vibe.
π dispatch($context, $stepdef, $short_circuit, $redispatch)
Accepts a Test::BDD::Cucumber::StepContext object, and a reference to a step definition triplet (verb, metadata hashref, coderef) and executes it the coderef.
You can also pass in a boolean 'short-circuit' flag if the Scenario's remaining steps should be skipped. πβοΈπ¨
β skip_step
Accepts a step-context, a result-type, and a textual reason, exercises the Harness's step start and step_done methods, and returns a skipped-test result. It said "not today" and logged it properly. πβ¨
π«Ά AUTHOR π«Ά
Peter Sergeant pete@clueball.com β ty king π
π LICENSE π
Copyright 2019-2023, Erik Huelsmann
Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl
and that's the whole page, bestie!! π this was perl v5.40.1, dated 2025-05-29, and the manpage goes by Test::...xecutor(3pm) β iconic of it tbh. mwah, go write some steps πππ¦
π¦ where this page comes from
- debian trixie: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms