Test::Pcuke::StepDefinition - Provides the commands for steps' definitions
This module is used to define steps. If you are pcuke user then you probably want save your step definitions to <your project>/features/step_definitions/steps.pm. Content of that file could look like this:
package steps; use utf8; # for i18n-zed regexps use warnings; use strict; use Test::Pcuke::StepDefinition; Given qr{^a calculator instance$} => sub { my ($world, $text, $table) = @_; $world->{_calculator} = Local::Adder->new; }; Given qr{^I have entered "([^"]+)" into the calculator} => sub { my ($world, $text, $table) = @_; push @{ $world->{_arguments} }, $1; }; When qr{^I press "([^"]+)"$} => sub { my ($world, $text, $table) = @_; my ($a1, $a2) = @{ $world->{_arguments} }; $world->{_result} = $world->{_calculator}->add( $a1, $a2 ); }; Then qr{^the result should be "([^"]+)" on the screen$} => sub { my ($world, $text, $table) = @_; expect( $world->{_result} )->equals($1); }; 1; # Do not forget this number. pcuke uses require
Note that if you can use native language in *.feature file you can't currently use native language for Given, When etc.
Given, When, Then, And, But
Synonym of the add_step.
Add a definition for a step whose title match $regexp.
See Test::Pcuke::Executor->add_definition().
Return Test::Pcuke::Expectation object. Use it for tests in step definitions
Andrei V. Toutoukine, <tut at isuct.ru>
<tut at isuct.ru>
Please report any bugs or feature requests to bug-test-pcuke at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Pcuke. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-test-pcuke at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Test::Pcuke::StepDefinition
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Pcuke
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Test-Pcuke
CPAN Ratings
http://cpanratings.perl.org/d/Test-Pcuke
Search CPAN
http://search.cpan.org/dist/Test-Pcuke/
Copyright 2011 Andrei V. Toutoukine.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Test::Pcuke, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Pcuke
CPAN shell
perl -MCPAN -e shell install Test::Pcuke
For more information on module installation, please visit the detailed CPAN module installation guide.