The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test2::Harness::Job - Control over a running test file.

DESCRIPTION

The job object is an abstract representation of a running test. It is responsible for starting the test using an Test2::Harness::Runner, managing the process with an Test2::Harness::Proc object, and delegating work to an Test2::Harness::Parser. The Test2::Harness object interacts directly with the Job object.

The job object is also responsible for sending Test2::Event::ProcessStart and Test2::Event::ProcessFinish events, as well as a few other events in the case of errors.

PUBLIC METHODS

Note not all private methods have _ prefixes yet. If the method is not on this list assume it is private. Some additional methods may be documented later.

$file = $j->file()

Get the test filename.

$id = $j->id()

Get the job's ID as used/assigned by the harness.

$bool = $j->is_done()

Check if the job is done yet.

$j->notify(@events)

This sends the events to all listeners, it also records them for the final result object and all subtest result objects.

$parser = $j->parser()

Get the Test2::Harness::Parser instance.

$proc = $j->proc()

Get the Test2::Harness::Proc instance.

$j->start(%params)

Start the job.

    $j->start(
        runner       => $runner, # The L<Test2::Harness::Runner> instance
        start_args   => \@args,  # Args passed into $runner->start
        parser_class => $parser, # Parser class to use.
    );
$bool = $j->step()

Run an iteration. This will return true if any events were generated, false otherwise. This is called in an event loop by the Test2::Harness object.

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