Barbie > Test-XHTML > Test::XHTML

Download:
Test-XHTML-0.12.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.12   Source  

NAME ^

Test::XHTML - Test web page code validation.

SYNOPSIS ^

    use Test::XHTML;

    my $tests = "t/102-internal-level7.csv";
    Test::XHTML::runtests($tests);

DESCRIPTION ^

Test the validation of a list of URLs. This includes DTD Validation, WAI WCAG v2.0 compliance and basic Best Practices.

FUNCTIONS ^

runtests(FILE)

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.

setlog(HASH)

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 );

CONFIGURATION ^

Options

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,

XHTML tests

Enable DTD valiadtion tests.

WAI WCAG v2.0 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)

Critique tests

Enable tests for some recommended Best Practices.

Dumping content

Where errors occur, it may be useful to obtain the page content to diagnose problems. Enabling this option will produce the content as disanostics.

NOTES ^

Test::XHTML::Valid & xhtml-valid

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.

Internet Access

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.

BUGS, PATCHES & FIXES ^

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 barbie@cpan.org.

Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me.

SEE ALSO ^

XML::LibXML, Test::XHTML::Valid

AUTHOR ^

  Barbie, <barbie@cpan.org>
  for Miss Barbell Productions <http://www.missbarbell.co.uk>.

COPYRIGHT AND LICENSE ^

  Copyright (C) 2008-2013 Barbie for Miss Barbell Productions.

  This distribution is free software; you can redistribute it and/or
  modify it under the Artistic Licence v2.
syntax highlighting: