Test::Spec::Acceptance - Write tests in a declarative specification style
use Test::Spec::Acceptance; # Also loads Test::Spec Feature "Test::Spec::Acceptance tests module" => sub { Scenario "Usage example" => sub { my ($number, $accumulated); Given "a relevant number" => sub { $number = 42; }; When "we add 0 to it" => sub { $accumulated = $number + 0 }; When "we add 0 again" => sub { $accumulated = $number + 0 }; Then "it does not change it's value" => sub { is($accumulated, 42); }; }; }; runtests;
This is a shameless wrapper around Test::Spec. It does everything Test::Spec does, plus it aliases some exported names to make acceptance-style tests more legible.
I understand this is a bit silly and this is not how Test::Spec is intended to work (using tests without any assertion) but I just think it's nice and more readable. I've had good experiencies expressing some tests this way.
Test::Spec
The new keywords are:
An alias for describe().
describe()
An alias for it().
it()
Please, see the excellent Test::Spec.
To install Test::Spec::Acceptance, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Spec::Acceptance
CPAN shell
perl -MCPAN -e shell install Test::Spec::Acceptance
For more information on module installation, please visit the detailed CPAN module installation guide.