TAP::Parser::Aggregator - Aggregate TAP::Parser results
Version 2.99_01
use TAP::Parser::Aggregator; my $aggregate = TAP::Parser::Aggregator->new; $aggregate->add( 't/00-load.t', $load_parser ); $aggregate->add( 't/10-lex.t', $lex_parser ); my $summary = <<'END_SUMMARY'; Passed: %s Failed: %s Unexpectedly succeeded: %s END_SUMMARY printf $summary, scalar $aggregate->passed, scalar $aggregate->failed, scalar $aggregate->todo_passed;
TAP::Parser::Aggregator collects parser objects and allows reporting/querying their aggregate results.
TAP::Parser::Aggregator
new
my $aggregate = TAP::Parser::Aggregator->new;
Returns a new TAP::Parser::Aggregator object.
add
$aggregate->add( $description => $parser );
The $description is usually a test file name (but only by convention.) It is used as a unique identifier (see e.g. "parsers".) Reusing a description is a fatal error.
$description
The $parser is a TAP::Parser object.
$parser
parsers
my $count = $aggregate->parsers; my @parsers = $aggregate->parsers; my @parsers = $aggregate->parsers(@descriptions);
In scalar context without arguments, this method returns the number of parsers aggregated. In list context without arguments, returns the parsers in the order they were added.
If @descriptions is given, these correspond to the keys used in each call to the add() method. Returns an array of the requested parsers (in the requested order) in list context or an array reference in scalar context.
@descriptions
Requesting an unknown identifier is a fatal error.
Each of the following methods will return the total number of corresponding tests if called in scalar context. If called in list context, returns the descriptions of the parsers which contain the corresponding tests (see add for an explanation of description.
failed
parse_errors
passed
skipped
todo
todo_passed
wait
exit
For example, to find out how many tests unexpectedly succeeded (TODO tests which passed when they shouldn't):
my $count = $aggregate->todo_passed; my @descriptions = $aggregate->todo_passed;
Note that wait and exit are the totals of the wait and exit statuses of each of the tests. These values are totalled only to provide a true value if any of them are non-zero.
total
my $tests_run = $aggregate->total;
Returns the total number of tests run.
has_problems
if ( $parser->has_problems ) { ... }
Returns true if any of the parsers has a result other than "all passed". This includes failed tests, TODO tests unexpectedly succeeded, parse errors, bad exit/wait status, etc.
todo_failed
# deprecated in favor of 'todo_passed'. This method was horribly misnamed.
This was a badly misnamed method. It indicates which TODO tests unexpectedly succeeded. Will now issue a warning and call todo_passed.
TAP::Parser
TAP::Harness
To install Test::Harness, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Harness
CPAN shell
perl -MCPAN -e shell install Test::Harness
For more information on module installation, please visit the detailed CPAN module installation guide.