Test::More::Behaviours - Group Test::More assertions into behaviours
This document describes Test::More::Behaviours
use Test::More::Behaviours tests => 9 ; ... sub set_up{ } sub tear_down{ } test "Validating email entered during signup" => sub { is $l->valid_email("") => 0, "should return 0 for empty email" ; is $l->valid_email("tot,\@l") => 0, "should return 0 for invalid email tot,\@l" ; ok $l->valid_email("hello\@world"), "should return 1 for valid email hello\@world.com" ; };
this module facilitate the grouping of Test::More assertions into Behaviours. This make the test easier to read and maintain as the assertions are logically grouped and dont' form a long list hard to the eye and prone to confusion. It will also make the TAP output more pleasant as the TAP lines are grouped into the behaviours defined in the test file. It is also possible to define a set_up and tear_down subroutine that will be called respectively before and after each behaviour test.
Test::More::Behaviours exports one subroutine
test BEHAVIOUR => sub { ASSERTIONS } ;
This is the structure used to group a collection of Test::More assertions around common behaviours.
BEHAVIOUR should be a concise description of the behaviour to test. It is recommended that it has an active form and is unambigous.
ASSERTIONS is a list of Test::More assertions. The descriptive message for each assertion should describe what the tested behaviour is expected to verify. It is recommended that it always start with "should ..."
test "validating email during signup" => sub { is validate("") => 0, "should return 0 for empty email" ; is validate("tyudaj@&") => 0, "should return 0 for invalid email tyudaj@&" ; ok validate("dfd@dfdf.com"), "should return 1 for valid email dfd@dfdf.com" ; };
Test::More::Behaviours requires no configuration files or environment variables.
<Test::More> <Sub::Uplevel>
None reported.
No bugs have been reported.
Please report any bugs or feature requests to bug-test-more-behaviours@rt.cpan.org, or through the web interface at http://rt.cpan.org.
bug-test-more-behaviours@rt.cpan.org
Antony Marcano, with contributions from Rija Menage <cpan AT rijam.sent.as> The name was found by Tim Brown
<cpan AT rijam.sent.as>
Copyright (c) 2007, The British Broadcasting Corporation. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Test::More::Behaviours, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::More::Behaviours
CPAN shell
perl -MCPAN -e shell install Test::More::Behaviours
For more information on module installation, please visit the detailed CPAN module installation guide.