Hi,

On Fri, Oct 29, 2010 at 6:24 PM, Graham TerMarsch <c...@howlingfrog.com> wrote:
> On October 28, 2010, Pedro Melo wrote:
>> All the process got me thinking about Test::Builder. I spent a couple
>> of hours tonight trying to see how would I output JUnit with TB2. I
>> tried to write a Formatter::JUnit and was mostly successful, but I
>> could not see how TB2 ties into the current TAP::Harness stack, that
>> powers App::Prove.
> [.....snip.....]
>> I'm sure I'm missing something and there is a plan to glue the Harness
>> with TB2 formatters. If some kind soul could take a little bit of time
>> to point me in the right direction (maybe there is a TAP2 tree
>> somewhere?), I could go and look and try to make use of my hacked
>> TB2::Formatter::JUnit.
>
> Hack or otherwise, I'd love to see what you've done w.r.t. this; we've got
> "TAP::Formatter::JUnit" on CPAN and if there's any experience/info that can be
> gleaned from your hacking that could improve that, I'd love to get it in
> there.

I mostly stole your code :)

You can see the result here:

http://github.com/melo/test-more/commits/junit-formatter/

It works with some of my tests with the following caveats:

 * the TAP plan is printed as the first line: Test::Builder outputs
the plan directly, without going through the Formatter object;
 * I don't have access to the pretty failure explanations like those
of 'is()': Test::More still uses Test::Builder and those explanations
are diag()'ed after the test result is reported.

Also, you cannot use prove. I've placed a script in examples/,
junit.pl that you must use to run each file of your testsuite. I need
this to setup the Test::Builder and Test::Builder2 to use the JUnit
formatter.

I would say that Test::Builder2 API is very very nice, but
Test::Builder still assumes everything is TAP all the way. For now, if
you want JUnit, TAP::Harness::JUnit or TAP::Formatter::JUnit are still
the best choices. At least until Test::Builder leverages
Test::Builder2 more profoundly.

Bye,
-- 
Pedro Melo
http://www.simplicidade.org/
xmpp:m...@simplicidade.org
mailto:m...@simplicidade.org

Reply via email to