[tap-l] Integrating TAP::Parser into an existing project

Marvin Humphrey marvin at rectangular.com
Sat May 24 02:46:13 UTC 2008


Greets,

I have an XS distro which currently does nearly all of its testing via  
Perl.  Since I would like to build bindings for this project to other  
languages, it would be best if the tests could be migrated to C but  
still produce TAP -- that way, TAP consumers for each binding language  
could work off of the TAP output from the common test files.

Wandering through the docs for TAP::Parser and its satellites, it  
wasn't clear to me how to integrate a TAP::Parser-based test instance  
into an existing build process.  Right now, './Build test' runs  
everything, and I would like that regime to continue as test files get  
migrated one-by-one from Perl to C.

I suppose that the obvious solution is to hack something like this:

     use Test::More;
     use TAP::Parser;

     my $test_output = qx|$c_test_executable|;

     my $parser = TAP::Parser->new( { tap => $test_output } );
     my $plan = $parser->next;
     die "no plan" unless $plan && $plan->is_plan;
     plan( tests => $plan->tests_planned );
     while ( my $result = $parser->next ) {
         ok( $result->is_ok, $result->as_string );
     }

However, the output from that is so messed up that it must not be the  
right way to go about things.

Is there a recipe for this strategy somewhere that I managed to  
overlook?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/



More information about the tap-l mailing list