Posted on 2008-11-03 19:14:57-08 by peterleonard
TAP::Harness, the aggregator, the parser, and results
Hello,
I'm having a lot of trouble getting the results I need out of TAP::Harness, and I could use some help.
I've used Test::Harness before, but only as a means to drive a set of test files, not to spend any time with the results. Now that I'm trying to dig out data on the results, I'm running into trouble and could use some help.
In a nutshell, @test_files is an array of .t test files, all using Test::More or Test::Class (and by extension, T::M) to do the test work.
The initial code is simply:
# run tests through Test::Harness use TAP::Harness; $ENV{PERL_TEST_HARNESS_DUMP_TAP} = $output_dir; my $harness = TAP::Harness->new( { verbosity => $v, lib => \@INC } ); # returns a TAP::Parser::Aggregator object my $aggregate = $harness->runtests(@test_files);

That runs fine, and $aggregate has the general stats on the run.
My problem is digging into the actual results.
@parsers = $aggregate->parsers(); my $p = $parsers[0]; while (my $res = $p->next) { # examine results here }

That doesn't work - while I get parser objects back, it never creates result objects properly -
$p->next()
always returns undef, regardless of how many tests were run under that parser.
What am I doing wrong here?
Thank you,
Peter
PS - is this the best forum to investigate this, or is there a better location?
Direct Responses: 11216 | Write a response
Posted on 2009-07-27 11:01:42-07 by ferdia in response to 9204
Re: TAP::Harness, the aggregator, the parser, and results
Hi Peter, I'm attempting to do the exact same thing and have not been able to find a solution. I need to execute the tests through the Harness in order to execute them in parallel. As far as I can tell calling
$p->next()
can't be called after running the tests through the Harness. So the individual results would need to be collected as the Harness is executing the tests. I can collect the Aggregator and Parser results but not the individual results. Did you ever find a resolution to this issue?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.