[DCPM] New testing module

Aaron Trevena aaron.trevena at gmail.com
Tue Dec 30 07:35:59 PST 2008


Hi all,

I've written a new testing module for a client, based on
Test::HTML::Content but skipping the xpath code, and making it faster
by re-using parse trees.

That means you can do funky tests like ..

text_ok($filename,'foo bar','found text : foo bar'); # check text found in file
no_text($filename,'Concert','no text matching : Concert'); # check
text found in file
image_ok($filename,'/images/error.gif','matching image found image in HTML');
link_ok($filename,'/foo/bar.cgi?id=123','Found link in HTML');

For added coolness, it also provides some new functions so that you
can test forms easily such as :

form_field_value_ok($filename,'category_id', 10297, undef,
'category_id matches');
form_select_field_ok($filename,{ field_name => $field_name, selected
=> $field_value,  form_name => $form_name}, $description);

Once I've got permission from the client I'll package it up for CPAN.

I was thinking of naming it Test::HTML

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting


More information about the Devoncornwall-pm mailing list