Test things other that code with TAP.

rblackwe on 2006-10-25T02:21:16

I am working on collecting examples of using TAP and TAP tools like prove to test things other than code. I hope to use these examples in a future talk.

I think that using TAP can be very effective in testing many situations.

I trust someone out there will have some very interesting examples.

Some examples: use Test::More qw( no_plan ); use Test::WWW::Mechanize; my $mech=Test::WWW::Mechanize->new(); my $uri = 'http://www.southsideworks.com/showtimes.htm'; $mech->get_ok( $uri ); $mech->content_contains( "The Prestige", "Desc " ); $mech->content_contains( "Elephant's Dream", "Desc " );

#!/usr/local/bin/perl use Test::More qw( no_plan ); my $command = `ping -o robertblackwell.com`; like ($command , qr/216.146.203.240/ );


Just my topic! :-)

jk2addict on 2006-10-25T02:34:11

I assume you've seen my posts about testing crap that goes wrong at $work?

http://use.perl.org/user/jk2addict/journal/31406

Unfortunately, most of the code is larger than would fit on a slide easily. The image tests are just -e $filename tests...the dup check is just a SELECT NAME, COUNT(*) AS TOTAL WHERE TOTAL > 1 kind of thing...the web page tests wouldn't make much sense outside of context...

The excel import one might be interesting enough.

See my Test::* modules

nik on 2006-10-25T11:48:03

This is why I wrote Test::Net::Connect, Test::Symlink, Test::Unix::Group, and Test::Unix::User (http://search.cpan.org/user/NIKC/). All designed to test the environment in which code will be running, rather than the code itself.