Test::XHTML - Test web page code validation.
use Test::XHTML; my $tests = "t/102-internal-level7.csv"; Test::XHTML::runtests($tests);
Test the validation of a list of URLs. This includes DTD Validation, WAI WCAG v2.0 compliance and basic Best Practices.
Runs the tests contained within FILE. The entries in FILE define how the tests are performed, and on what.
A simple file might look like:
#,# Configuration, config,xhtml=1, url,http://mysite/index.html,Test My Page
Where each field on the comma separated line represent 'cmd', 'text' and 'label'. Valid 'cmd' values are:
# - comment line, ignores the line config - set configuration value (see below) all body - test that 'text' exists in body content of all urls. all body not - test that 'text' does not exist in body content of all urls. url - test single url body - test that 'text' exists in body content of the previous url. body not - test that 'text' does not exist in body content of the previous url. form - name and type of form to use with subsequent input commands, when more than one form exists in the page. input - form fill, use as 'fieldname=xxx', with 'submit' as the last input to submit the form.
The 'label' is used with the tests, and if left blank will be automatically generated.
If required will record a test run to a log file. If you do not wish to record multiple runs, set 'logclean => 1' and log file will be recreated each time. Otherwise all results are appended to the named log file.
Test::XHTML::setlog( logfile => './test.log', logclean => 1 );
There are currently 4 configuration options available, which can be listed in your test file as follows:
#,# Configuration, config,xhtml=1, config,wai=1, config,critic=1, config,dump=1,
Enable DTD valiadtion tests.
Enable WAI WCAG v2.0 tests. Values can be set to represent the level of compliance required.
config,wai=1, # Level A compliance config,wai=2, # Level AA compliance config,wai=3, # Level AAA compliance (not currently available)
Enable tests for some recommended Best Practices.
Where errors occur, it may be useful to obtain the page content to diagnose problems. Enabling this option will produce the content as disanostics.
The underlying package that provides the DTD validation framework, is only used sparingly by Test::XHTML. Many more methods to test websites (both remote and local) are supported, and can be accessed via the xhtml-valid script that accompanies this distribution.
See script documentation and Test::XHTML::Valid for further details.
In some instances XML::LibXML may require internet access to obtain all the necessary W3C and DTD specifications as denoted in the web pages you are attempting to validate. However, for some more common specifications, for HTML4 and XHTML1, this distribution pre-loads the XML Catalog to avoid making calls across the internet.
There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties, that is not explained within the POD documentation, please send bug reports and patches to firstname.lastname@example.org.
Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me.
Barbie, <email@example.com> for Miss Barbell Productions <http://www.missbarbell.co.uk>.
Copyright (C) 2008-2015 Barbie for Miss Barbell Productions. This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.