1Test::Reporter(3) User Contributed Perl Documentation Test::Reporter(3)
2
3
4
6 Test::Reporter - sends test results to cpan-testers@perl.org
7
9 version 1.62
10
12 use Test::Reporter;
13
14 my $reporter = Test::Reporter->new(
15 transport => 'File',
16 transport_args => [ '/tmp' ],
17 );
18
19 $reporter->grade('pass');
20 $reporter->distribution('Mail-Freshmeat-1.20');
21 $reporter->send() || die $reporter->errstr();
22
23 # or
24
25 my $reporter = Test::Reporter->new(
26 transport => 'File',
27 transport_args => [ '/tmp' ],
28 );
29
30 $reporter->grade('fail');
31 $reporter->distribution('Mail-Freshmeat-1.20');
32 $reporter->comments('output of a failed make test goes here...');
33 $reporter->edit_comments(); # if you want to edit comments in an editor
34 $reporter->send() || die $reporter->errstr();
35
36 # or
37
38 my $reporter = Test::Reporter->new(
39 transport => 'File',
40 transport_args => [ '/tmp' ],
41 grade => 'fail',
42 distribution => 'Mail-Freshmeat-1.20',
43 from => 'whoever@wherever.net (Whoever Wherever)',
44 comments => 'output of a failed make test goes here...',
45 via => 'CPANPLUS X.Y.Z',
46 );
47 $reporter->send() || die $reporter->errstr();
48
50 Test::Reporter reports the test results of any given distribution to
51 the CPAN Testers project. Test::Reporter has wide support for various
52 perl5's and platforms.
53
54 CPAN Testers no longer receives test reports by email, but reports
55 still resemble an email message. This module has numerous legacy
56 "features" left over from the days of email transport.
57
58 Transport mechanism
59 The choice of transport is set with the "transport" argument. CPAN
60 Testers should usually install Test::Reporter::Transport::Metabase and
61 use 'Metabase' as the "transport". See that module for necessary
62 transport arguments. Advanced testers may wish to test on a machine
63 different from the one used to send reports. Consult the CPAN Testers
64 Wiki <http://wiki.cpantesters.org/> for examples using other transport
65 classes.
66
67 The legacy email-based transports have been split out into a separate
68 Test::Reporter::Transport::Legacy distribution and methods solely
69 related to email have been deprecated.
70
72 Required attributes
73 · distribution
74
75 Gets or sets the name of the distribution you're working on, for
76 example Foo-Bar-0.01. There are no restrictions on what can be put
77 here.
78
79 · from
80
81 Gets or sets the e-mail address of the individual submitting the
82 test report, i.e. "John Doe <jdoe@example.com>".
83
84 · grade
85
86 Gets or sets the success or failure of the distributions's 'make
87 test' result. This must be one of:
88
89 grade meaning
90 ----- -------
91 pass all tests passed
92 fail one or more tests failed
93 na distribution will not work on this platform
94 unknown tests did not exist or could not be run
95
96 Transport attributes
97 · transport
98
99 Gets or sets the transport type. The transport type argument is
100 refers to a 'Test::Reporter::Transport' subclass. The default is
101 'Null', which uses the Test::Reporter::Transport::Null class and
102 does nothing when "send" is called.
103
104 You can add additional arguments after the transport selection.
105 These will be passed to the constructor of the lower-level
106 transport. See "transport_args".
107
108 $reporter->transport(
109 'File', '/tmp'
110 );
111
112 This is not designed to be an extensible platform upon which to
113 build transport plugins. That functionality is planned for the
114 next-generation release of Test::Reporter, which will reside in the
115 CPAN::Testers namespace.
116
117 · transport_args
118
119 Optional. Gets or sets transport arguments that will used in the
120 constructor for the selected transport, as appropriate.
121
122 Optional attributes
123 · comments
124
125 Gets or sets the comments on the test report. This is most commonly
126 used for distributions that did not pass a 'make test'.
127
128 · debug
129
130 Gets or sets the value that will turn debugging on or off. Debug
131 messages are sent to STDERR. 1 for on, 0 for off. Debugging
132 generates very verbose output and is useful mainly for finding bugs
133 in Test::Reporter itself.
134
135 · dir
136
137 Defaults to the current working directory. This method specifies
138 the directory that write() writes test report files to.
139
140 · timeout
141
142 Gets or sets the timeout value for the submission of test reports.
143 Default is 120 seconds.
144
145 · via
146
147 Gets or sets the value that will be appended to X-Reported-Via,
148 generally this is useful for distributions that use Test::Reporter
149 to report test results. This would be something like "CPANPLUS
150 0.036".
151
152 Deprecated attributes
153 CPAN Testers no longer uses email for submitting reports. These
154 attributes are deprecated.
155
156 · address
157
158 · mail_send_args
159
160 · mx
161
163 · new
164
165 This constructor returns a Test::Reporter object.
166
167 · perl_version
168
169 Returns a hashref containing _archname, _osvers, and _myconfig
170 based upon the perl that you are using. Alternatively, you may
171 supply a different perl (path to the binary) as an argument, in
172 which case the supplied perl will be used as the basis of the above
173 data. Make sure you protect it from the shell in case there are
174 spaces in the path:
175
176 $reporter->perl_version(qq{"$^X"});
177
178 · subject
179
180 Returns the subject line of a report, i.e. "PASS
181 Mail-Freshmeat-1.20 Darwin 6.0". 'grade' and 'distribution' must
182 first be specified before calling this method.
183
184 · report
185
186 Returns the actual content of a report, i.e. "This distribution
187 has been tested as part of the cpan-testers...". 'comments' must
188 first be specified before calling this method, if you have comments
189 to make and expect them to be included in the report.
190
191 · send
192
193 Sends the test report to cpan-testers@perl.org via the defined
194 "transport" mechanism. You must check errstr() on a send() in
195 order to be guaranteed delivery.
196
197 · edit_comments
198
199 Allows one to interactively edit the comments within a text editor.
200 comments() doesn't have to be first specified, but it will work
201 properly if it was. Accepts an optional hash of arguments:
202
203 · suffix
204
205 Optional. Allows one to specify the suffix ("extension") of the
206 temp file used by edit_comments. Defaults to '.txt'.
207
208 · errstr
209
210 Returns an error message describing why something failed. You must
211 check errstr() on a send() in order to be guaranteed delivery.
212
213 · write and read
214
215 These methods are used in situations where you wish to save reports
216 locally rather than transmitting them to CPAN Testers immediately.
217 You use write() on the machine that you are testing from, transfer
218 the written test reports from the testing machine to the sending
219 machine, and use read() on the machine that you actually want to
220 submit the reports from. write() will write a file in an internal
221 format that contains 'From', 'Subject', and the content of the
222 report. The filename will be represented as:
223 grade.distribution.archname.osvers.seconds_since_epoch.pid.rpt.
224 write() uses the value of dir() if it was specified, else the cwd.
225
226 On the machine you are testing from:
227
228 my $reporter = Test::Reporter->new
229 (
230 grade => 'pass',
231 distribution => 'Test-Reporter-1.16',
232 )->write();
233
234 On the machine you are submitting from:
235
236 # wrap in an opendir if you've a lot to submit
237 my $reporter;
238 $reporter = Test::Reporter->new()->read(
239 'pass.Test-Reporter-1.16.i686-linux.2.2.16.1046685296.14961.rpt'
240 )->send() || die $reporter->errstr();
241
242 write() also accepts an optional filehandle argument:
243
244 my $fh; open $fh, '>-'; # create a STDOUT filehandle object
245 $reporter->write($fh); # prints the report to STDOUT
246
247 Deprecated methods
248 · message_id
249
251 If you experience a long delay sending reports with Test::Reporter, you
252 may be experiencing a wait as Test::Reporter attempts to determine your
253 email address. Always use the "from" parameter to set your email
254 address explicitly.
255
257 For more about CPAN Testers:
258
259 · CPAN Testers reports <http://www.cpantesters.org/>
260
261 · CPAN Testers wiki <http://wiki.cpantesters.org/>
262
264 Bugs / Feature Requests
265 Please report any bugs or feature requests through the issue tracker at
266 <https://github.com/cpan-testers/Test-Reporter/issues>. You will be
267 notified automatically of any progress on your issue.
268
269 Source Code
270 This is open source software. The code repository is available for
271 public review and contribution under the terms of the license.
272
273 <https://github.com/cpan-testers/Test-Reporter>
274
275 git clone https://github.com/cpan-testers/Test-Reporter.git
276
278 · Adam J. Foxson <afoxson@pobox.com>
279
280 · David Golden <dagolden@cpan.org>
281
282 · Kirrily "Skud" Robert <skud@cpan.org>
283
284 · Ricardo Signes <rjbs@cpan.org>
285
286 · Richard Soderberg <rsod@cpan.org>
287
288 · Kurt Starsinic <Kurt.Starsinic@isinet.com>
289
291 · Andreas Koenig <andk@cpan.org>
292
293 · Ed J <mohawk2@users.noreply.github.com>
294
295 · Tatsuhiko Miyagawa <miyagawa@bulknews.net>
296
297 · Vincent Pit <perl@profvince.com>
298
300 This software is copyright (c) 2015 by Authors and Contributors.
301
302 This is free software; you can redistribute it and/or modify it under
303 the same terms as the Perl 5 programming language system itself.
304
305
306
307perl v5.30.1 2020-01-30 Test::Reporter(3)