VERSION
version 0.50DESCRIPTION
Provides the Given/When/Then functions, and a method for loading Step Definition files and returning the steps.SYNOPSIS
Defining steps:
#!perl
use strict; use warnings; use Test::More;
use Test::BDD::Cucumber::StepFile;
Given 'something', sub { print "YEAH!" }
When qr/smooooth (\d+)/, sub { print "YEEEHAH $1" }
Then qr/something (else)/, sub { S->{'match'} = $1 }
Step qr/die now/, sub { die "now" }
Transform qr/^(\d+)$/, sub { int $1 }
Before sub { setup_db() }
After sub { teardown() }
Loading steps, in a different file:
use Test::BDD::Cucumber::StepFile; my @steps = Test::BDD::Cucumber::StepFile->load('filename_steps.pl');
EXPORTED FUNCTIONS
Given
When
Then
Step
Transform
Before
After
Accept a regular expression or string, and a coderef. Some cute tricks ensure that when you call the "load()" method on a file with these statements in, these are returned to it...C
S
Return the context and the Scenario stash, respectively, but only when called inside a step definition.load
Loads a file containing step definitions, and returns a list of the steps defined in it, of the form:
( [ 'Given', qr/abc/, sub { etc } ], [ 'Step', 'asdf', sub { etc } ] )
AUTHOR
Peter Sergeant "[email protected]"LICENSE
Copyright 2011-2016, Peter Sergeant; Licensed under the same terms as Perl