The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test2::Harness::Collector::Auditor::Job - Class to monitor events for a single job and pass judgement on the result .

DESCRIPTION

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.

SYNOPSIS

use Test2::Harness::Collector::Auditor::Job;

my $auditor = Test2::Harness::Collector::Auditor::Job->new();

for my $event (@events) {
    $auditor->process($event);
}

print "Pass!" if $auditor->pass;
print "Fail!" if $auditor->fail;

METHODS

$int = $auditor->assertion_count()

Number of assertions that have been seen.

$exit = $auditor->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 auditor has not seen the exit event yet) this will return undef.

$bool = $auditor->fail()

Returns true if the job has failed/is failing.

@error_facets = $auditor->fail_error_facet_list

Used internally to get a list of 'error' facets to inject into the harness_job_exit event.

$file = $auditor->file

If the test file is known this will return it (string). This will return undef if the file is not yet known.

$string = $auditor->halt

If the test was halted (bail-out) this will contain the human readible reason.

$bool = $auditor->has_exit

Check if the exit value is known.

$bool = $auditor->has_plan

Check if a plan has been seen.

$file = $auditor->file

file that is running

$int = $auditor->nested

If this auditor represents a subtest this will be an integer greater than 0, the top-level test is 0.

$hash = $auditor->numbers

This is an internal state tracking what test numbers have been seen. This is really only applicable in tests that produced TAP.

$bool = $auditor->pass

Check if the test job is passing.

$plan_facet = $auditor->plan()

If the plan facet has been seen this will return it.

$auditor->process($event);

Modify the state based on the provided event.

$auditor->subtest_fail_error_facet_list

Used internally to get a list of 'error' facets to inject into the harness_job_exit event.

$times = $auditor->times()

Retuns the Test2::Harness::Log::TimeTracker instance.

$int = $auditor->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.

SOURCE

The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 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/