NAME
Test::Proto::TestRunner - Embodies a run through a test
SYNOPSIS
my $runner = Test::Proto::TestRunner->new(test_case=>$testCase);
my $subRunner $runner->subtest;
$subRunner->pass;
$runner->done();
Note that it is a Moo class.
Unless otherwise specified, the return value is itself.
ATTRIBUTES
All of these attributes are chainable as setters.
subject
Returns the test subject
test_case
Returns the test case or the prototype
parent
Returns the parent of the test.
is_complete
Returns 1
if the test run has finished, 0
otherwise.
value
Returns 0
if the test run has failed or exception, 1
otherwise.
skipped_tags
If any test case or prototype has one of the tags in this list, the runner will skip it.
required_tags
If this list is not empty, then unless a test case or prototype has a tag in this list, the runner will skip it.
is_exception
Returns 1
if the test run has run into an exception, 0
otherwise.
is_info
Returns 1
if the result is for information purposes, 0
otherwise.
is_skipped
Returns 1
if the test case was skipped, 0
otherwise.
children
Returns an arrayref
status_message
This is a string which indicates the reason for skipping, exception info, etc.
formatter
Returns the formatter used.
METHODS
complete
$self->complete(0);
$self->complete(0, 'Something went wrong');
Declares the test run is complete. It is intended that this is only called by the other methods done
, pass
, fail
, exception
, diag
, skip
.
subtest
Creates and returns a child, which is another TestRunner. The child keeps the same formatter, subject, and test_case as the parent. The child is added to the parent's list of events.
add_event
Adds an event to the runner.
done
$self->done;
$self->done ('Completed check of widgets');
Declares that the test run is complete, and determines if the result is a pass or a fail - if there are any failures, then the result is deemed to be a failure.
pass
$self->pass;
Declares that the test run is complete, and declares the result to be a pass, irrespective of what the results of the subtests were.
fail
$self->fail;
Declares that the test run is complete, and declares the result to be a failure, irrespective of what the results of the subtests were.
diag
$self->diag;
Declares that the test run is complete, and declares that it is not a result but a diagnostic message, irrespective of what the results of the subtests were.
skip
$self->skip;
Declares that the test run is complete, but that it was skipped.
exception
$self->exception;
Declares that the test run is complete, and declares the result to be an exception, irrespective of what the results of the subtests were.
inform_formatter
$self->inform_formatter;
Used internally to send events to the formatter. The two events currently permitted are 'new' and 'done'.
status
$self->status;
Useful to summarise the status of the TestRunner. Possible values are: FAIL, PASS, INFO, SKIPPED, EXCEPTION, INCOMPLETE.
run_test
$self->run_test($test, $proto);
This method runs a particular test in the object's script, and returns the subtest. It is called by the Test::Proto::Base::run_tests
and should only be called by subclasses of Test::Proto::Base which override that method.
This is documented for information purposes only and is not intended to be used except in the maintainance of Test::Proto
itself.
object_id, object_uuid
Test::Proto::TestRunner implements Object::ID. This is used by formatters.