1Test2::Manual::Testing(U3s)er Contributed Perl DocumentatTieosnt2::Manual::Testing(3)
2
3
4

NAME

6       Test2::Manual::Testing - Hub for documentation about writing tests with
7       Test2.
8

DESCRIPTION

10       This document outlines all the tutorials and POD that cover writing
11       tests. This section does not cover any Test2 internals, nor does it
12       cover how to write new tools, for that see Test2::Manual::Tooling.
13

NAMESPACE MAP

15       When writing tests there are a couple namespaces to focus on:
16
17       Test2::Tools::*
18           This is where toolsets can be found. A toolset exports functions
19           that help you make assertions about your code. Toolsets will only
20           export functions, they should not ever have extra/global effects.
21
22       Test2::Plugins::*
23           This is where plugins live. Plugins should not export anything, but
24           instead will introduce or alter behaviors for Test2 in general.
25           These behaviors may be lexically scoped, or they may be global.
26
27       Test2::Bundle::*
28           Bundles combine toolsets and plugins together to reduce your
29           boilerplate. First time test writers are encouraged to start with
30           the Test2::V0 bundle (which is an exception to the namespace rule
31           as it does not live under "Test2::Bundle::"). If you find yourself
32           loading several plugins and toolsets over and over again you could
33           benefit from writing your own bundle.
34
35       Test2::Require::*
36           This namespace contains modules that will cause a test to skip if
37           specific conditions are not met. Use this if you have tests that
38           only run on specific perl versions, or require external libraries
39           that may not always be available.
40

LISTING DEPENDENCIES

42       When you use Test2, specifically things included in Test2::Suite you
43       need to list them in your modules test dependencies. It is important to
44       note that you should list the tools/plugins/bundles you need, you
45       should not simply list Test2::Suite as your dependency. Test2::Suite is
46       a living distribution intended to represent the "current" best
47       practices. As tools, plugins, and bundles evolve, old ones will become
48       discouraged and potentially be moved from Test2::Suite into their own
49       distributions.
50
51       One goal of Test2::Suite is to avoid breaking backwards compatibility.
52       Another goal is to always improve by replacing bad designs with better
53       ones.  When necessary Test2::Suite will break old modules out into
54       separate dists and define new ones, typically with a new bundle. In
55       short, if we feel the need to break something we will do so by creating
56       a new bundle, and discouraging the old one, but we will not break the
57       old one.
58
59       So for example, if you use Test2::V0, and Dist::Zilla you should have
60       this in your config:
61
62           [Prereqs / TestRequires]
63           Test2::V0 = 0.000060
64
65       You SHOULD NOT do this:
66
67           [Prereqs / TestRequires]
68           Test2::Suite = 0.000060
69
70       Because Test2::V0 might not always be part of Test2::Suite.
71
72       When writing new tests you should often check Test2::Suite to see what
73       the current recommended bundle is.
74
75       Dist::Zilla
76
77           [Prereqs / TestRequires]
78           Test2::V0 = 0.000060
79
80       ExtUtils::MakeMaker
81
82           my %WriteMakefileArgs = (
83             ...,
84             "TEST_REQUIRES" => {
85               "Test2::V0" => "0.000060"
86             },
87             ...
88           );
89
90       Module::Install
91
92           test_requires 'Test2::V0' => '0.000060';
93
94       Module::Build
95
96           my $build = Module::Build->new(
97               ...,
98               test_requires => {
99                   "Test2::V0" => "0.000060",
100               },
101               ...
102           );
103

TUTORIALS

105   SIMPLE/INTRODUCTION TUTORIAL
106       Test2::Manual::Testing::Introduction is an introduction to writing
107       tests using the Test2 tools.
108
109   MIGRATING FROM TEST::BUILDER and TEST::MORE
110       Test2::Manual::Testing::Migrating Is a tutorial for converting old
111       tests that use Test::Builder or Test::More to the newer Test2 way of
112       doing things.
113
114   ADVANCED PLANNING
115       Test2::Manual::Testing::Planning is a tutorial on the many ways to set
116       a plan.
117
118   TODO TESTS
119       Test2::Manual::Testing::Todo is a tutorial for markings tests as TODO.
120
121   SUBTESTS
122       COMING SOON.
123
124   COMPARISONS
125       COMING SOON.
126
127       SIMPLE COMPARISONS
128
129       COMING SOON.
130
131       ADVANCED COMPARISONS
132
133       COMING SOON.
134
135   TESTING EXPORTERS
136       COMING SOON.
137
138   TESTING CLASSES
139       COMING SOON.
140
141   TRAPPING
142       COMING SOON.
143
144       TRAPPING EXCEPTIONS
145
146       COMING SOON.
147
148       TRAPPING WARNINGS
149
150       COMING SOON.
151
152   DEFERRED TESTING
153       COMING SOON.
154
155   MANAGING ENCODINGS
156       COMING SOON.
157
158   AUTO-ABORT ON FAILURE
159       COMING SOON.
160
161   CONTROLLING RANDOM BEHAVIOR
162       COMING SOON.
163
164   WRITING YOUR OWN BUNDLE
165       COMING SOON.
166

TOOLSET DOCUMENTATION

168       COMING SOON.
169

PLUGIN DOCUMENTATION

171       COMING SOON.
172

BUNDLE DOCUMENTATION

174       COMING SOON.
175

REQUIRE DOCUMENTATION

177       COMING SOON.
178

SEE ALSO

180       Test2::Manual - Primary index of the manual.
181

SOURCE

183       The source code repository for Test2-Manual can be found at
184       https://github.com/Test-More/Test2-Suite/.
185

MAINTAINERS

187       Chad Granum <exodist@cpan.org>
188

AUTHORS

190       Chad Granum <exodist@cpan.org>
191
193       Copyright 2018 Chad Granum <exodist@cpan.org>.
194
195       This program is free software; you can redistribute it and/or modify it
196       under the same terms as Perl itself.
197
198       See http://dev.perl.org/licenses/
199
200
201
202perl v5.38.0                      2023-07-21         Test2::Manual::Testing(3)
Impressum