1Test2::Manual::Testing:U:sPelranCnoinntgr(i3b)uted PerlTDeosctu2m:e:nMtaantuiaoln::Testing::Planning(3)
2
3
4

NAME

6       Test2::Manual::Testing::Planning - The many ways to set a plan.
7

DESCRIPTION

9       This tutorial covers the many ways of setting a plan.
10

TEST COUNT

12       The "plan()" function is provided by Test2::Tools::Basic. This function
13       lets you specify an exact number of tests to run. This can be done at
14       the start of testing, or at the end. This cannot be done partway
15       through testing.
16
17           use Test2::Tools::Basic;
18           plan(10); # 10 tests expected
19
20           ...
21

DONE TESTING

23       The "done_testing()" function is provided by Test2::Tools::Basic. This
24       function will automatically set the plan to the number of tests that
25       were run.  This must be used at the very end of testing.
26
27           use Test2::Tools::Basic;
28
29           ...
30
31           done_testing();
32

SKIP ALL

34       The "skip_all()" function is provided by Test2::Tools::Basic. This
35       function will set the plan to 0, and exit the test immediately. You may
36       provide a skip reason that explains why the test should be skipped.
37
38           use Test2::Tools::Basic;
39           skip_all("This test will not run here") if ...;
40
41           ...
42

CUSTOM PLAN EVENT

44       A plan is simply an Test2::Event::Plan event that gets sent to the
45       current hub. You could always write your own tool to set the plan.
46
47           use Test2::API qw/context/;
48
49           sub set_plan {
50               my $count = @_;
51
52               my $ctx = context();
53               $ctx->send_event('Plan', max => $count);
54               $ctx->release;
55
56               return $count;
57           }
58

SEE ALSO

60       Test2::Manual - Primary index of the manual.
61

SOURCE

63       The source code repository for Test2-Manual can be found at
64       https://github.com/Test-More/Test2-Suite/.
65

MAINTAINERS

67       Chad Granum <exodist@cpan.org>
68

AUTHORS

70       Chad Granum <exodist@cpan.org>
71
73       Copyright 2018 Chad Granum <exodist@cpan.org>.
74
75       This program is free software; you can redistribute it and/or modify it
76       under the same terms as Perl itself.
77
78       See http://dev.perl.org/licenses/
79
80
81
82perl v5.34.0                      2021-11-16Test2::Manual::Testing::Planning(3)
Impressum