Debian Codegraph @

upstream/mageia-cauldron/man3pm/Test2.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Test2 3pm"
61 .TH Test2 3pm 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Test2 \- Framework for writing test tools that all work together.
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 Test2 is a new testing framework produced by forking Test::Builder,
71 completely refactoring it, adding many new features and capabilities.
72 .SS "WHAT IS NEW?"
73 .IX Subsection "WHAT IS NEW?"
74 .IP "Easier to test new testing tools." 4
75 .IX Item "Easier to test new testing tools."
76 From the beginning Test2 was built with introspection capabilities. With
77 Test::Builder it was difficult at best to capture test tool output for
78 verification. Test2 Makes it easy with \f(CWTest2::API::intercept()\fR.
79 .IP "Better diagnostics capabilities." 4
80 .IX Item "Better diagnostics capabilities."
81 Test2 uses an Test2::API::Context object to track filename, line number, and
82 tool details. This object greatly simplifies tracking for where errors should
83 be reported.
84 .IP "Event driven." 4
85 .IX Item "Event driven."
86 Test2 based tools produce events which get passed through a processing system
87 before being output by a formatter. This event system allows for rich plugin
88 and extension support.
89 .IP "More complete API." 4
90 .IX Item "More complete API."
91 Test::Builder only provided a handful of methods for generating lines of TAP.
92 Test2 took inventory of everything people were doing with Test::Builder that
93 required hacking it up. Test2 made public API functions for nearly all the
94 desired functionality people didn\*(Aqt previously have.
95 .IP "Support for output other than TAP." 4
96 .IX Item "Support for output other than TAP."
97 Test::Builder assumed everything would end up as TAP. Test2 makes no such
98 assumption. Test2 provides ways for you to specify alternative and custom
99 formatters.
100 .IP "Subtest implementation is more sane." 4
101 .IX Item "Subtest implementation is more sane."
102 The Test::Builder implementation of subtests was certifiably insane. Test2 uses
103 a stacked event hub system that greatly improves how subtests are implemented.
104 .IP "Support for threading/forking." 4
105 .IX Item "Support for threading/forking."
106 Test2 support for forking and threading can be turned on using Test2::IPC.
107 Once turned on threading and forking operate sanely and work as one would
108 expect.
109 .SH "GETTING STARTED"
110 .IX Header "GETTING STARTED"
111 If you are interested in writing tests using new tools then you should look at
112 Test2::Suite. Test2::Suite is a separate cpan distribution that contains
113 many tools implemented on Test2.
114 .PP
115 If you are interested in writing new tools you should take a look at
116 Test2::API first.
117 .SH "NAMESPACE LAYOUT"
118 .IX Header "NAMESPACE LAYOUT"
119 This describes the namespace layout for the Test2 ecosystem. Not all the
120 namespaces listed here are part of the Test2 distribution, some are implemented
121 in Test2::Suite.
122 .SS Test2::Tools::
123 .IX Subsection "Test2::Tools::"
124 This namespace is for sets of tools. Modules in this namespace should export
125 tools like \f(CWok()\fR and \f(CWis()\fR. Most things written for Test2 should go here.
126 Modules in this namespace \fBMUST NOT\fR export subs from other tools. See the
127 "Test2::Bundle::" namespace if you want to do that.
128 .SS Test2::Plugin::
129 .IX Subsection "Test2::Plugin::"
130 This namespace is for plugins. Plugins are modules that change or enhance the
131 behavior of Test2. An example of a plugin is a module that sets the encoding to
132 utf8 globally. Another example is a module that causes a bail\-out event after
133 the first test failure.
134 .SS Test2::Bundle::
135 .IX Subsection "Test2::Bundle::"
136 This namespace is for bundles of tools and plugins. Loading one of these may
137 load multiple tools and plugins. Modules in this namespace should not implement
138 tools directly. In general modules in this namespace should load tools and
139 plugins, then re\-export things into the consumers namespace.
140 .SS Test2::Require::
141 .IX Subsection "Test2::Require::"
142 This namespace is for modules that cause a test to be skipped when conditions
143 do not allow it to run. Examples would be modules that skip the test on older
144 perls, or when non\-essential modules have not been installed.
145 .SS Test2::Formatter::
146 .IX Subsection "Test2::Formatter::"
147 Formatters live under this namespace. Test2::Formatter::TAP is the only
148 formatter currently. It is acceptable for third party distributions to create
149 new formatters under this namespace.
150 .SS Test2::Event::
151 .IX Subsection "Test2::Event::"
152 Events live under this namespace. It is considered acceptable for third party
153 distributions to add new event types in this namespace.
154 .SS Test2::Hub::
155 .IX Subsection "Test2::Hub::"
156 Hub subclasses (and some hub utility objects) live under this namespace. It is
157 perfectly reasonable for third party distributions to add new hub subclasses in
158 this namespace.
159 .SS Test2::IPC::
160 .IX Subsection "Test2::IPC::"
161 The IPC subsystem lives in this namespace. There are not many good reasons to
162 add anything to this namespace, with exception of IPC drivers.
163 .PP
164 \fITest2::IPC::Driver::\fR
165 .IX Subsection "Test2::IPC::Driver::"
166 .PP
167 IPC drivers live in this namespace. It is fine to create new IPC drivers and to
168 put them in this namespace.
169 .SS Test2::Util::
170 .IX Subsection "Test2::Util::"
171 This namespace is for general utilities used by testing tools. Please be
172 considerate when adding new modules to this namespace.
173 .SS Test2::API::
174 .IX Subsection "Test2::API::"
175 This is for Test2 API and related packages.
176 .SS Test2::
177 .IX Subsection "Test2::"
178 The Test2:: namespace is intended for extensions and frameworks. Tools,
179 Plugins, etc should not go directly into this namespace. However extensions
180 that are used to build tools and plugins may go here.
181 .PP
182 In short: If the module exports anything that should be run directly by a test
183 script it should probably NOT go directly into \f(CW\*(C`Test2::XXX\*(C'\fR.
184 .SH "SEE ALSO"
185 .IX Header "SEE ALSO"
186 Test2::API \- Primary API functions.
187 .PP
188 Test2::API::Context \- Detailed documentation of the context object.
189 .PP
190 Test2::IPC \- The IPC system used for threading/fork support.
191 .PP
192 Test2::Formatter \- Formatters such as TAP live here.
193 .PP
194 Test2::Event \- Events live in this namespace.
195 .PP
196 Test2::Hub \- All events eventually funnel through a hub. Custom hubs are how
197 \&\f(CWintercept()\fR and \f(CWrun_subtest()\fR are implemented.
198 .SH "CONTACTING US"
199 .IX Header "CONTACTING US"
200 Many Test2 developers and users lurk on <irc://irc.perl.org/#perl\-qa> and
201 <irc://irc.perl.org/#toolchain>. We also have a slack team that can be joined
202 by anyone with an \f(CW\*(C`@cpan.org\*(C'\fR email address <https://perl\-test2.slack.com/>
203 If you do not have an \f(CW\*(C`@cpan.org\*(C'\fR email you can ask for a slack invite by
204 emailing Chad Granum <[email protected]>.
205 .SH SOURCE
206 .IX Header "SOURCE"
207 The source code repository for Test2 can be found at
208 <https://github.com/Test\-More/test\-more/>.
209 .SH MAINTAINERS
210 .IX Header "MAINTAINERS"
211 .IP "Chad Granum <[email protected]>" 4
212 .IX Item "Chad Granum <[email protected]>"
213 .SH AUTHORS
214 .IX Header "AUTHORS"
215 .IP "Chad Granum <[email protected]>" 4
216 .IX Item "Chad Granum <[email protected]>"
217 .SH COPYRIGHT
218 .IX Header "COPYRIGHT"
219 Copyright Chad Granum <[email protected]>.
220 .PP
221 This program is free software; you can redistribute it and/or
222 modify it under the same terms as Perl itself.
223 .PP
224 See <https://dev.perl.org/licenses/>