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::Tools::HarnessTester(3) User Contributed Perl Documentation Test2::Tools::HarnessTester(3)

Test2::Tools::HarnessTester - Run events through a harness for a summary

This tool allows you to process events through the Test2::Harness auditor. The main benefit here is to get a pass/fail result, as well as counts for assertions, failures, and errors.

    use Test2::V0;
    use Test2::API qw/intercept/;
    use Test2::Tools::HarnessTester qw/summarize_events/;

    my $events = intercept {
        ok(1, "pass");
        ok(2, "pass gain");
        done_testing;
    };

    is(
        summarize_events($events),
        {
            # Each of these is the negation of the other, no need to check both
            pass       => 1,
            fail       => 0,

            # The plan facet, see Test2::EventFacet::Plan
            plan       => {count => 2},

            # Statistics
            assertions => 2,
            errors     => 0,
            failures   => 0,
        }
    );

This takes an arrayref of events, such as that produced by "intercept {...}" from Test2::API. The result is a hashref that summarizes the results of the events as processed by Test2::Harness, specifically the Test2::Harness::Auditor::Watcher module.

Fields in the summary hash:

pass => $BOOL
fail => $BOOL
These are negatives of eachother. These represent the pass/fail state after processing the events. When one is true the other should be false. These are normalized to 1 and 0.
plan => $HASHREF
If a plan was provided this will have the Test2::EventFacet::Plan facet, but as a hashref, not a blessed instance.

Note: This is reference to the original data, not a copy, if you modify it you will modify the event as well.

assertions => $INT
Count of assertions made.
errors => $INT
Count of errors seen.
failures => $INT
Count of failures seen.

This will create a temporary directory with 't', 't2', and 'xt' subdirectories each of which will contain a single passing test.

This is re-exported from App::Yath::Tester.

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.