• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Test/H03-May-2022-350170

t/H03-May-2022-203145

xt/H03-May-2022-1412

Build.PLH A D18-May-2020301 134

ChangesH A D18-May-2020737 3524

LICENSEH A D18-May-20201.1 KiB3326

MANIFESTH A D18-May-2020315 2020

META.jsonH A D18-May-20202.2 KiB9190

META.ymlH A D18-May-20201.2 KiB5251

README.mdH A D18-May-20204.3 KiB12893

cpanfileH A D18-May-2020242 119

README.md

1# NAME
2
3Test::Cukes - A BBD test tool inspired by Cucumber
4
5# SYNOPSIS
6
7Write your test program like this:
8
9    # test.pl
10    use Test::Cukes;
11    # use Test::Cukes tests => 3;
12
13    feature(<<TEXT);
14    Feature: writing behavior tests
15      In order to make me happy
16      As a test maniac
17      I want to write behavior tests
18
19      Scenario: Hello World
20        Given the test program is running
21        When it reaches this step
22        Then it should pass
23    TEXT
24
25    Given qr/the (.+) program is (.+)/, sub {
26        my ($program_name, $running_or_failing) = @_;
27        assert "running program '$program_name'";
28    };
29
30    When qr/it reaches this step/, sub {
31        assert "reaches";
32    };
33
34    Then qr/it should pass/, sub {
35        assert "passes";
36    };
37
38    runtests;
39
40When it runs, it looks like this:
41
42    > perl test.pl
43    1..3
44    ok 1 - Given the test program is running
45    ok 2 - When it reaches this step
46    ok 3 - Then it should pass
47
48# DESCRIPTION
49
50Test::Cukes is a testing tool inspired by Cucumber
51([http://cukes.info](http://cukes.info)). It lets your write your module test with
52scenarios. It may be used with [Test::More](https://metacpan.org/pod/Test::More) or other family of
53TAP `Test::*` modules. It uses [Test::Builder::note](https://metacpan.org/pod/Test::Builder::note) function
54internally to print messages.
55
56This module implements the Given-When-Then clause only in English. To
57uses it in the test programs, feed the feature text into `feature`
58function, defines your step handlers, and then run all the tests by
59calling `runtests`. Step handlers may be defined in separate modules,
60as long as those modules are included before `runtests` is called.
61Each step may use either `assert` or standard TAP functions such as
62`Test::Simple`'s `ok` or `Test::More`'s `is` to verify desired
63result.  If you specify a plan explicitly, you should be aware that
64each step line in your scenario runs an additional test, and will
65therefore add to the number of tests you must indicate.
66
67If any assertion in the Given block failed, the following `When` and
68`Then` blocks are all skipped.
69
70You don't need to specify the number of tests with `plan`. Each step
71block itself is simply one test. If the block died, it's then
72considered failed. Otherwise it's considered as passing.
73
74In the call to [Test::Cukes::runtests](https://metacpan.org/pod/Test::Cukes::runtests), [done\_testing](https://metacpan.org/pod/done_testing) will automatically
75be called for you if you didn't specify a plan.
76
77Test::Cukes re-exports `assert` function from `Carp::Assert` for you
78to use in the step block.
79
80For more info about how to define feature and scenarios, please read
81the documents from [http://cukes.info](http://cukes.info).
82
83# AUTHOR
84
85Kang-min Liu <gugod@gugod.org>
86
87# CONTRIBUTORS
88
89Tatsuhiko Miyagawa, Tristan Pratt
90
91# SEE ALSO
92
93The official Cucumber web-page, [http://cukes.info/](http://cukes.info/).
94
95cucumber.pl, [http://search.cpan.org/dist/cucumber/](http://search.cpan.org/dist/cucumber/), another Perl
96implementation of Cucumber tool.
97
98[Carp::Assert](https://metacpan.org/pod/Carp::Assert)
99
100# LICENSE
101
102This is free software, licensed under:
103
104    The MIT (X11) License
105
106# DISCLAIMER OF WARRANTY
107
108BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
109FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
110OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
111PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
112EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
113WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
114ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
115YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
116NECESSARY SERVICING, REPAIR, OR CORRECTION.
117
118IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
119WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
120REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
121LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
122OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
123THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
124RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
125FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
126SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
127SUCH DAMAGES.
128