If you run an “always on” e-commerce site (perhaps using some of the high-availability tricks described in this issue), you must ensure that search forms really operate and that the pages pointed to have reasonable content. Validation is vital for dynamic web sites, especially those that generate an “everything’s OK” 200 status when the content of the page contains a Java traceback from a database connection. To truly have high availability, you have to watch the associated programs and databases — not just that the links on your pages all go somewhere reasonable.
If you run an “always on” e-commerce site (perhaps using some of the high-availability tricks described in this issue), you must ensure that search forms really operate and that the pages pointed to have reasonable content. Validation is vital for dynamic web sites, especially those that generate an “everything’s OK” 200 status when the content of the page contains a Java traceback from a database connection. To truly have high availability, you have to watch the associated programs and databases — not just that the links on your pages all go somewhere reasonable.
The trick is to regularly run a Perl program to connect to your web server and perform requests as if it was a visitor’s browser. While validation can be performed rather directly with the LWP package (or even low-level programming with sockets directly), I save time and energy using the rapidly-evolving WWW::Mechanize package found in the CPAN. With WWW::Mechanize, I get a virtual user agent that steers like a browser.
The next step is to figure out if the right responses are being returned from the web browser. For that, I prefer the Test: :More module that’s installed with modern Perl versions (and can be fetched from the CPAN for older Perl versions).
The Test::More module includes a number of tests that ultimately display a series of ok and not ok messages on stdout. These messages are normally interpreted by Test: :Harness to give an overall “thumbs up” or “thumbs down” to a…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: