Test::...xecutor(3pm)

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

✨ 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 matching is 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 " β€” A Test::BDD::Cucumber::Model::Feature object
  • " feature_stash " β€” A hashref that should live the lifetime of feature execution
  • " harness " β€” A Test::BDD::Cucumber::Harness subclass object
  • " outline " β€” A Test::BDD::Cucumber::Model::Scenario object
  • " background " β€” An optional Test::BDD::Cucumber::Model::Scenario object representing the Background

πŸ’œ execute_scenario

Accepts a hashref of options, and executes each step in a scenario. Options:

  • "feature" β€” A Test::BDD::Cucumber::Model::Feature object
  • "feature_stash" β€” A hashref that should live the lifetime of feature execution
  • "harness" β€” A Test::BDD::Cucumber::Harness subclass object
  • "scenario" β€” A Test::BDD::Cucumber::Model::Scenario object
  • "background_obj" β€” An optional Test::BDD::Cucumber::Model::Scenario object 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