Test2::Harness::Auditor::Watcher - Class to monitor events for a single job and
pass judgement on the result.
This module represents a per-job state tracker. This module sees every event and
manages the state produced. In the end this tracker determines if a test job
passed or failed, and why.
use Test2::Harness::Auditor::Watcher;
my $watcher = Test2::Harness::Auditor::Watcher->new();
for my $event (@events) {
$watcher->process($event);
}
print "Pass!" if $watcher->pass;
print "Fail!" if $watcher->fail;
- $int = $watcher->assertion_count()
- Number of assertions that have been seen.
- $exit = $watcher->exit()
- If the job has exited this will return the exit value (integer, 0 or
greater). If the job has not exited yet (or at least if the watcher has
not seen the exit event yet) this will return undef.
- $bool = $watcher->fail()
- Returns true if the job has failed/is failing.
- @error_facets = $watcher->fail_error_facet_list
- Used internally to get a list of 'error' facets to inject into the
harness_job_exit event.
- $file = $watcher->file
- If the test file is known this will return it (string). This will return
undef if the file is not yet known.
- $string = $watcher->halt
- If the test was halted (bail-out) this will contain the human readible
reason.
- $bool = $watcher->has_exit
- Check if the exit value is known.
- $bool = $watcher->has_plan
- Check if a plan has been seen.
- $job = $watcher->job
- If the job is known this will return the detailed structure of the
job.
- $int = $watcher->nested
- If this watcher represents a subtest this will be an integer greater than
0, the top-level test is 0.
- $hash = $watcher->numbers
- This is an internal state tracking what test numbers have been seen. This
is really only applicable in tests that produced TAP.
- $bool = $watcher->pass
- Check if the test job is passing.
- $plan_facet = $watcher->plan()
- If the plan facet has been seen this will return it.
- $watcher->process($event);
- Modify the state based on the provided event.
- $watcher->subtest_fail_error_facet_list
- Used internally to get a list of 'error' facets to inject into the
harness_job_exit event.
- $times = $watcher->times()
- Retuns the Test2::Harness::Auditor::TimeTracker instance.
- $int = $watcher->try()
- Sometimes a job is run more than once, in those cases this will be an
integer greater than 0 representing the try. 0 is used for the first
try.
The source code repository for Test2-Harness can be found at
http://github.com/Test-More/Test2-Harness/.
- Chad Granum <exodist@cpan.org>
- Chad Granum <exodist@cpan.org>
Copyright 2020 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/