1Test2::Harness::AuditorU:s:eWratCcohnetrr(i3b)uted PerlTDeosctu2m:e:nHtaartnieosns::Auditor::Watcher(3)
2
3
4
6 Test2::Harness::Auditor::Watcher - Class to monitor events for a single
7 job and pass judgement on the result.
8
10 This module represents a per-job state tracker. This module sees every
11 event and manages the state produced. In the end this tracker
12 determines if a test job passed or failed, and why.
13
15 use Test2::Harness::Auditor::Watcher;
16
17 my $watcher = Test2::Harness::Auditor::Watcher->new();
18
19 for my $event (@events) {
20 $watcher->process($event);
21 }
22
23 print "Pass!" if $watcher->pass;
24 print "Fail!" if $watcher->fail;
25
27 $int = $watcher->assertion_count()
28 Number of assertions that have been seen.
29
30 $exit = $watcher->exit()
31 If the job has exited this will return the exit value (integer, 0
32 or greater). If the job has not exited yet (or at least if the
33 watcher has not seen the exit event yet) this will return undef.
34
35 $bool = $watcher->fail()
36 Returns true if the job has failed/is failing.
37
38 @error_facets = $watcher->fail_error_facet_list
39 Used internally to get a list of 'error' facets to inject into the
40 harness_job_exit event.
41
42 $file = $watcher->file
43 If the test file is known this will return it (string). This will
44 return undef if the file is not yet known.
45
46 $string = $watcher->halt
47 If the test was halted (bail-out) this will contain the human
48 readible reason.
49
50 $bool = $watcher->has_exit
51 Check if the exit value is known.
52
53 $bool = $watcher->has_plan
54 Check if a plan has been seen.
55
56 $job = $watcher->job
57 If the job is known this will return the detailed structure of the
58 job.
59
60 $int = $watcher->nested
61 If this watcher represents a subtest this will be an integer
62 greater than 0, the top-level test is 0.
63
64 $hash = $watcher->numbers
65 This is an internal state tracking what test numbers have been
66 seen. This is really only applicable in tests that produced TAP.
67
68 $bool = $watcher->pass
69 Check if the test job is passing.
70
71 $plan_facet = $watcher->plan()
72 If the plan facet has been seen this will return it.
73
74 $watcher->process($event);
75 Modify the state based on the provided event.
76
77 $watcher->subtest_fail_error_facet_list
78 Used internally to get a list of 'error' facets to inject into the
79 harness_job_exit event.
80
81 $times = $watcher->times()
82 Retuns the Test2::Harness::Auditor::TimeTracker instance.
83
84 $int = $watcher->try()
85 Sometimes a job is run more than once, in those cases this will be
86 an integer greater than 0 representing the try. 0 is used for the
87 first try.
88
90 The source code repository for Test2-Harness can be found at
91 http://github.com/Test-More/Test2-Harness/.
92
94 Chad Granum <exodist@cpan.org>
95
97 Chad Granum <exodist@cpan.org>
98
100 Copyright 2020 Chad Granum <exodist7@gmail.com>.
101
102 This program is free software; you can redistribute it and/or modify it
103 under the same terms as Perl itself.
104
105 See http://dev.perl.org/licenses/
106
107
108
109perl v5.36.1 2023-10-04Test2::Harness::Auditor::Watcher(3)