|
NAMETest2::Tools::HarnessTester - Run events through a harness for a summary DESCRIPTIONThis 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. SYNOPSIS 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,
}
);
EXPORTS$summary = summarize_events($events)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:
$path = make_example_dir()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. SOURCEThe source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/. MAINTAINERSAUTHORSCOPYRIGHTCopyright 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/
|