There is a nice chapter on just this topic in Perl Testing by
Lanworth and
chromatic (see
http://shop.oreilly.com/product/9780596100926.do )
and gives clear examples using WWW::Mechanize. You'll be up and testing in no time.
To save you some time, here's a couple of hints from my brief experience:
# check the html on the page - skip this for brevity
$mech->page_links_ok();
html_tidy_ok( $mech->content() );
This does a lot of work in just two little lines.
$mech->content_contains( 'Sorry, we couldn’t find anything that
+matched your search.' );
This one took me forever to work out how to match the apostrophe. I went with the html entity in the end.
perl -e 'print qq(Just another Perl Hacker\n)' # where's the irony switch?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.