Michael G Schwern > Test-Simple-1.005000_006 > TB2::SubtestStart

Download:
Test-Simple-1.005000_006.tar.gz

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

TB2::SubtestStart - Start of a subtest event

DESCRIPTION ^

This is a TB2::Event representing the start of a subtest.

A subtest is a set of code and events which has a state separate from the main test. The intent is to provide a clean slate to perform tests in small chunks. This could be a block of tests in a larger file, or the tests of a single method.

A subtest has its own history, plan and set of results.

Receiving this event indicates that a subtest is about to start, all events from here to TB2::SubtestEnd belong to the subtest. Most event handlers will not have to be concerned about this, the TestState will call subtest_handler on each event handler to get a new one to handle the subtest.

Information about the subtest can be communicated back to the parent handler via information contained in the TB2::SubtestEnd.

METHODS ^

It has all the methods and attributes of TB2::Event with the following differences and additions.

Attributes

depth

How deeply nested this subtest is. The first subtest will have a depth of 1. A subtest inside that subtest will have a depth of 2 and so on.

It has no default. The depth is typically set by "post_event" in TB2::TestState and need not be set by the creator of the event. Only set it if you wish to override the normal depth.

name

The name of this subtest.

directives

Any directives which were in effect when the subtest started.

These should be applied to the result of the subtest.

Usually used for todo blocks.

reason

The reason for any directives.

build_event_type

The event type is subtest_start.

SEE ALSO ^

TB2::Event This does the Event role.

TB2::SubtestEnd The cooresponding event which ends the subtest.

"subtest_handler" in TB2::EventHandler The method called on each Handler when a subtest starts.

syntax highlighting: