This document contains some information about the Web Application WG's Test Harness which is the same test harness that is used by the HTML WG.
- To provide a convenient API for making common assertions
- To work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests
Test cases written for WebApps' test suites should use this test harness.
The basic usage of the harness (
testharness.js) is described in the beginning of the file.
- To use this script file, import the script into the test document via the following script tag. Note that an expectation is that all tests must be run-able in place in the W3C's test repository. As such, an absolute path to the script file must be used and the script file will be in
resourcesdirectory at the root of the repository.
- Each test can have one or more asserts. Note: some prefer a test is limited to a single assert but that is not mandatory.
- Each test is atomic in the sense that a single test has a single result (pass/fail/timeout).
- A test fails at the first failing assert, and the remainder of the test is (typically) not run.
- If the file containing the tests is a HTML file with an element of id "log", this will be populated with a table containing the test results after all the tests have run.
Bug Reporting and Discussion
The discussion forum for the test harness is the W3C's cross-WG
public-test-infra mail list. This list is also used to report
testharness.js bugs or bugs can also be directly added to the W3C's Bugzilla: Product = Testing; Component = testharness.js (James Graham is the "default assignee").
See Also ...
- For more information about this harness, see the documentation included at the top of the
testharness.jsand the Examples section below.
- Robin Berjon's using-testharness.js