The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::BDD::Cucumber::Executor - Run through Feature and Harness objects

VERSION

version 0.54

DESCRIPTION

The Executor runs through Features, matching up the Step Lines with Step Definitions, and reporting on progress through the passed-in harness.

METHODS

extensions

add_extensions

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.

<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( 1 );
  add_extensions( 2, 3 );

The pre_* will be called in order 2, 3, 1, and post_* will be called in 1, 3, 2.

steps

add_steps

The attributes steps is a hashref of arrayrefs, storing steps by their Verb. add_steps() takes step definitions of the item list form:

 (
  [ Given => qr//, sub {} ],
 ),

and populates steps with them.

execute

Execute accepts a feature object, a harness object, and an optional Test::BDD::Cucumber::TagSpec 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 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 - We'll create a new scenario stash unless you've posted one in. This is used exclusively for giving Background sections access to the same stash as the scenario they're running before.

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.

add_placeholders

Accepts a text string and a hashref, and replaces <placeholders > with the values in the hashref, returning a string.

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.

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.

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.

dispatch

Accepts a Test::BDD::Cucumber::StepContext object, and a Test::BDD::Cucumber::Step object and executes it.

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.

AUTHOR

Peter Sergeant pete@clueball.com

LICENSE

Copyright 2011-2016, Peter Sergeant; Licensed under the same terms as Perl