To run a particular test in your Python program, against a page located at the given URL, you must perform the following steps:
import wachecker.location
location = wachecker.location.Location ('http://www.example.com')
By default (unless overridden with the refresh_cache variable
in config.py) WAchecker caches Web pages it fetches. To use a
fresh copy of a page instead of the cached version, use the
refresh_cache optional argument:
location = wachecker.location.Location ('http://www.example.com',
refresh_cache=True)
import wachecker.test
wachecker.test.load_all_tests ()
test = wachecker.test.Test__WCAG_1__1_1 ()
The load_all_tests ensures all tests from the directories
defined the variable test_directories in config.py are
loaded. In this example, test testing for conformance with Web
Content Accessibility Guidelines 1.0, checkpoint 1.0 is run.
Note test constructors take no arguments. Tests are represented by their classes, their instances serve only for storing auxiliary data when performing the test.
List of all available tests can be retrieved using the
wachecker.test.all_tests () call, which returns sequence of
pairs (test-class-name, test-class).
issues = test.run (location)
The resulting value is a sequence of wachecker.test.Issue
instances described in following section.