Debian Codegraph @

lib/Test2/Harness/Renderer.pm

raw
1 package Test2::Harness::Renderer;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use Carp qw/croak/;
8
9 use Test2::Harness::Util::HashBase qw/-settings -verbose -progress -color -command_class/;
10
11 sub render_event { croak "$_[0] forgot to override 'render_event()'" }
12
13 sub step {}
14
15 sub finish { }
16
17 sub signal { }
18
19 1;
20
21 __END__
22
23 =pod
24
25 =encoding UTF-8
26
27 =head1 NAME
28
29 Test2::Harness::Renderer - Base class for Test2::Harness event renderers.
30
31 =head1 DESCRIPTION
32
33 =head1 ATTRIBUTES
34
35 These are set at construction time and cannot be changed.
36
37 =over 4
38
39 =item $settings = $renderer->settings
40
41 Get the L<Test2::Harness::Settings> reference.
42
43 =item $int = $renderer->verbose
44
45 Get the verbosity level.
46
47 =item $bool = $renderer->progress
48
49 True if progress indicators should be shown.
50
51 =item $bool = $renderer->color
52
53 True if color should be used.
54
55 =back
56
57 =head1 METHODS
58
59 =over 4
60
61 =item $renderer->render_event($event)
62
63 Called for every event. Return is ignored.
64
65 =item $renderer->finish(%ARGS)
66
67 Called once after testing is done.
68
69 C<%ARGS>:
70
71 =item $renderer->signal($signal)
72
73 Called when the rendering process receives a signal. This is your chance to do
74 any cleanup or report the signal. This is not an event, you can ignore it. Do
75 not exit or throw any exceptions here please.
76
77 =over 4
78
79 =item settings => $settings
80
81 Get the L<Test2::Harness::Settings> reference.
82
83 =item pass => $bool
84
85 True if tests passed.
86
87 =item tests_seen => $int
88
89 Number of test files seen.
90
91 =item asserts_seen => $int
92
93 Number of assertions made.
94
95 =item final_data => $final_data
96
97 The final_data looks like this, note that some data may not be present if it is
98 not applicable. The data structure can be as simple as
99 C<< { pass => $bool } >>.
100
101 {
102 pass => $pass, # boolean, did the test run pass or fail?
103
104 failed => [ # Jobs that failed, and did not pass on a retry
105 [$job_id1, $file1], # Failing job 1
106 [$job_id2, $file2], # Failing job 2
107 ...
108 ],
109 retried => [ # Jobs that failed and were retried
110 [$job_id1, $times_run1, $file1, $passed_eventually1], # Passed_eventually is a boolean
111 [$job_id2, $times_run2, $file2, $passed_eventually2],
112 ...
113 ],
114 hatled => [ # Jobs that caused the entire test suite to halt
115 [$job_id1, $file1, $halt_reason1], # halt_reason is a human readible string
116 [$job_id2, $file2, $halt_reason2],
117 ],
118 }
119
120 =back
121
122 =back
123
124 =head1 SOURCE
125
126 The source code repository for Test2-Harness can be found at
127 F<http://github.com/Test-More/Test2-Harness/>.
128
129 =head1 MAINTAINERS
130
131 =over 4
132
133 =item Chad Granum E<lt>[email protected]<gt>
134
135 =back
136
137 =head1 AUTHORS
138
139 =over 4
140
141 =item Chad Granum E<lt>[email protected]<gt>
142
143 =back
144
145 =head1 COPYRIGHT
146
147 Copyright 2020 Chad Granum E<lt>[email protected]<gt>.
148
149 This program is free software; you can redistribute it and/or
150 modify it under the same terms as Perl itself.
151
152 See F<http://dev.perl.org/licenses/>
153
154 =cut