The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::More::Behaviour - BDD module for Perl

INSTALL

  cpan -i Test::More::Behaviour

SYNOPSIS

  describe 'Bank Account' => sub {
    context 'transferring money' => sub {
      it 'withdrawals amount from the source account' => sub {
        my $source = BankAccount->new(100);
        my $target = BankAccount->new(0);
        $source->transfer(50, $target);
        is($source->balance, 50);
      };
      it 'deposits amount into target account' => sub {
        my $source = BankAccount->new(100);
        my $target = BankAccount->new(0);
        $source->transfer(50, $target);
        is($target->balance, 50);
      };
    };
  };

DESCRIPTION

Test::More::Behaviour is a Behaviour-Driven Development module for Perl programmers. It is modeled after Rspec (http://rspec.info) the infamous BDD tool for Ruby programmers.

Since Test::More::Behaviour uses Test::More as its 'base', you can treat every Test::More::Behaviour test as if it were Test::More!

QUICK REFERENCE

This project is built with the philosophy that 'Tests are the Documentation'. For a full set of features, please read through the test scenarios.

describe

Use to group a set of examples of a particular behaviour of the system that you wish you describe.

it

An example to run.

context

Use this to further establish deeper relations for a set of examples. This is best used when several examples have similar interactions with the system but have differring expectations.

before_all =item before_each =item after_each =item after_all

You can use these to define code which executes before and after each example or only once per example group.

SOURCE

The source code for Test::More::Behaviour can be found at https://github.com/bostonaholic/test-more-behaviour

KNOWN BUGS

None, yet. But please, send me an email or send me a github pull request with a broken test (and your fix if you're able to) and I will be more than happy to fix.

DEPENDENCIES

Test::More Term::ANSIColor version IO::Capture::Stdout (test only)

AUTHOR

Matthew Boston <matthew DOT boston AT gmail DOT com> with special thanks to Dustin Williams.

* I assume no responsibility if this documentation is incorrect or outdated. The tests are fully documenting of this software.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 133:

'=item' outside of any '=over'

Around line 152:

You forgot a '=back' before '=head1'