Hi,

when I am writing a test script for a perl module or even
an application I am writing, the output I get from TAP seems enough.
When I write a test for an application where the author is someone
else and sometime the person running the test is a 3rd one, in those
case we usually need more details to drill down.

It is not unique to it but let me give an example with Test::WWW::Mechanize.

When this call fails

$mech->content_like(qr{regex});

it gives me a part of the content of the page. That's
ok in the TAP stream but I'd like to be able to save
the actual content and later let the user see it.

I could write this:

$mech->content_like(qr{regex}) or diag $mech->content;

but then I get all the content in the TAP stream making it quite unreadable.

Maybe I need something like this:

$mech->content_like(qr{regex}) or do {
    my $filename = 'some_filename';
    if (open my $fh, '>', $filename) {
        print $fh $mech->content;
        diag "File: $filename";
    }
};

and then parse the TAP output for 'File:' *after* a test failure.

Is there a better way to do this?

regards
   Gabor


-- 
Gabor Szabo
http://szabgab.com/

Reply via email to