Scroll to navigation

Test::BDD::Cucumber::StepFile(3pm) User Contributed Perl Documentation Test::BDD::Cucumber::StepFile(3pm)

NAME

Test::BDD::Cucumber::StepFile - Functions for creating and loading Step Definitions

VERSION

version 0.11

DESCRIPTION

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;
 use Method::Signatures; # Allows short-hand func method
 Given 'something',          func ($c) { print "YEAH!" }
 When  qr/smooooth (\d+)/,   func ($c) { print "YEEEHAH $1" }
 Then  qr/something (else)/, func ($c) { print "Meh $1" }
 Step  qr/die now/,          func ($c) { die "now" }
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

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...

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 "pete@clueball.com"

LICENSE

Copyright 2011, Peter Sergeant; Licensed under the same terms as Perl
2012-05-20 perl v5.14.2