GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test2::Harness::Event(3) User Contributed Perl Documentation Test2::Harness::Event(3)

Test2::Harness::Event - Subclass of Test2::Event used by Test2::Harness under the hood.

Test2 tests produce a sequence of events objects Test2::Event. This is a subclass of those events for use in Test2::Harness. Event non-test tests which produce TAP output will have the output parsed into these types of events.

In normal usage ou will never need to create one fo these events yourself. This documentation assumes you are operating on an existing event $event that the harness exposed to you via a plugin or similar.

    my $facet_data = $event->facet_data;
    my $run_id     = $event->run_id;
    my $job_id     = $event->job_id;
    my $job_try    = $event->job_try;
    my $event_id   = $event->event_id;

See Test2::Event for methods provided by the base class.
$hashref = $event->TO_JSON
Used for json serialization.
$json_string = $event->as_json
This will return a json representation of the event. Note that this is a lossy conversion with some harness specific state removed by design. This may even be a cached copy of the json string that was decoded to produce the original object. If the string was not cached before it will be cached for all future calls ignoring any state change to the event.

The lossy/cached conversion is intended so that events get passed through the harness pipeline without modifications from one step translating to another. If you need something extra to go through you need to either replace the event or create an additional one.

$string = $event->event_id
Usually a UUID, but not always!
i$hashref = $event->facet_data
Get the event facet data, this is the meat of the event that hold all the state.
$string = $event->job_id
Usually a UUID, but not always!
$int = $event->job_try
Integer, 0 or greater. Some jobs are run additional times if they fail, this says which attempt the event is for. The counter starts at 0.
$bool = $event->processed
This will be true if the event has been process by the harness. Note that this attibute is not serialized by "TO_JSON" or "as_json".
$string = $event->run_id
The run id. This is usually a UUID, but not always!
$ts = $event->stamp
A unix timestamp for when the event was created.
$id = $event->stream_id
This is an implementation detail of Test2::Formatter::Stream, do not rely on it. This is used to prevent parsing errors when stream output is nested in other stream output, which can happen if you are writing tests for the stream formatter itself.
$trace = $event->trace
This si a shortcut for "$event->facet_data->{trace}". The trace data is essential and used everywhere.

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/

2022-03-23 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.