Test::BDD::Cucumber::Executor - Run through Feature and Harness objects
version 0.86
The Executor runs through Features, matching up the Step Lines with Step Definitions, and reporting on progress through the passed-in harness.
The value of this attribute should be one of first (default), relaxed and strict.
first
relaxed
strict
By default (first), the first matching step is executed immediately, terminating the search for (further) matching steps. When matching is set to anything other than first, all steps are checked for matches. When set to relaxed, a warning will be generated on multiple matches. When set to strict, an exception will be thrown.
matching
The attributes extensions is an arrayref of Test::BDD::Cucumber::Extension extensions. Extensions have their hook-functions called by the Executor at specific points in the BDD feature execution.
extensions
<add_extensions adds items in FIFO using unshift()>, and are called in reverse order at the end hook; this means that if you:
<add_extensions
add_extensions( 1 ); add_extensions( 2, 3 );
The pre_* will be called in order 2, 3, 1, and post_* will be called in 1, 3, 2.
pre_*
post_*
The attributes steps is a hashref of arrayrefs, storing steps by their Verb. add_steps() takes step definitions of the item list form:
steps
add_steps()
( [ 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 populates steps with them.
Execute accepts a feature object, a harness object, and an optional Cucumber::TagExpressions::ExpressionNode object and for each scenario in the feature which meets the tag requirements (or all of them, if you haven't specified one), runs execute_scenario.
execute_scenario
Accepts a hashref of options and executes each scenario definition in the scenario outline, or, lacking an outline, executes the single defined scenario.
Options:
feature - A Test::BDD::Cucumber::Model::Feature object
feature
feature_stash - A hashref that should live the lifetime of feature execution
feature_stash
harness - A Test::BDD::Cucumber::Harness subclass object
harness
outline - A Test::BDD::Cucumber::Model::Scenario object
outline
background - An optional Test::BDD::Cucumber::Model::Scenario object representing the Background
background
Accepts a hashref of options, and executes each step in a scenario. Options:
scenario - A Test::BDD::Cucumber::Model::Scenario object
scenario
background_obj - An optional Test::BDD::Cucumber::Model::Scenario object representing the Background
background_obj
scenario_stash - A hashref that lives the lifetime of the scenario execution
scenario_stash
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.
dispatch()
Accepts a text string and a hashref, and replaces <placeholders > with the values in the hashref, returning a string.
<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.
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).
$self-
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.
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.
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.
Peter Sergeant pete@clueball.com
pete@clueball.com
Copyright 2019-2023, Erik Huelsmann Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl
To install Test::BDD::Cucumber, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::BDD::Cucumber
CPAN shell
perl -MCPAN -e shell install Test::BDD::Cucumber
For more information on module installation, please visit the detailed CPAN module installation guide.