1 The Web Platform Tests Project [](http://irc.w3.org/?channels=testing)
2 ==============================
4 The Web Platform Tests Project is a W3C-coordinated attempt to build a
5 cross-browser testsuite for the Web-platform stack. However, for mainly
6 historic reasons, the CSS WG testsuite is in a separate repository,
7 [csswg-test](https://github.com/w3c/csswg-test). Writing tests in a way
8 that allows them to be run in all browsers gives browser projects
9 confidence that they are shipping software that is compatible with other
10 implementations, and that later implementations will be compatible with
11 their implementations. This in turn gives Web authors/developers
12 confidence that they can actually rely on the Web platform to deliver on
13 the promise of working across browsers and devices without needing extra
14 layers of abstraction to paper over the gaps left by specification
15 editors and implementors.
20 The tests are designed to be run from your local computer. The test
21 environment requires Python 2.7+ (but not Python 3.x). You will also
22 need a copy of OpenSSL. Users on Windows should read the
23 [Windows Notes](#windows-notes) section below.
25 To get the tests running, you need to set up the test domains in your
26 [`hosts` file](http://en.wikipedia.org/wiki/Hosts_%28file%29%23Location_in_the_file_system). The
27 following entries are required:
30 127.0.0.1 web-platform.test
31 127.0.0.1 www.web-platform.test
32 127.0.0.1 www1.web-platform.test
33 127.0.0.1 www2.web-platform.test
34 127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
35 127.0.0.1 xn--lve-6lad.web-platform.test
38 Because web-platform-tests uses git submodules, you must ensure that
39 these are up to date. In the root of your checkout, run:
42 git submodule update --init --recursive
45 The test environment can then be started using
51 This will start HTTP servers on two ports and a websockets server on
52 one port. By default one web server starts on port 8000 and the other
53 ports are randomly-chosen free ports. Tests must be loaded from the
54 *first* HTTP server in the output. To change the ports, edit the
55 `config.json` file, for example, replacing the part that reads:
58 "http": [8000, "auto"]
61 to some port of your choice e.g.
67 If you installed OpenSSL in such a way that running `openssl` at a
68 command line doesn't work, you also need to adjust the path to the
69 OpenSSL binary. This can be done by adding a section to `config.json`
73 "ssl": {"openssl": {"binary": "/path/to/openssl"}}
76 <span id="windows-notes">Windows Notes</span>
77 =============================================
79 Running wptserve with SSL enabled on Windows typically requires
80 installing an OpenSSL distribution.
81 [Shining Light](http://slproweb.com/products/Win32OpenSSL.html)
82 provide a convenient installer that is known to work, but requires a
85 After installation ensure that the path to OpenSSL is on your `%Path%`
88 Then set the path to the default OpenSSL configuration file (usually
89 something like `C:\OpenSSL-Win32\bin\openssl.cfg` in the server
90 configuration. To do this copy `config.default.json` in the
91 web-platform-tests root to `config.json`. Then edit the JSON so that
92 the key `ssl/openssl/base_conf_path` has a value that is the path to
93 the OpenSSL config file.
99 There is a test runner that is designed to provide a
100 convenient way to run the web-platform tests in-browser. It will run
101 testharness.js tests automatically but requires manual work for
102 reftests and manual tests.
104 The runner can be found at `/tools/runner/index.html` on the local
108 http://web-platform.test:8000/tools/runner/index.html
111 in the default configuration. The first time you use this it has to
112 generate a manifest of all tests. This may take some time, so please
118 The master branch is automatically synced to http://w3c-test.org/.
120 Pull requests that have been checked are automatically mirrored to
121 http://w3c-test.org/submissions/.
126 Each top-level directory represents a W3C specification: the name
127 matches the shortname used after the canonical address of the said
128 specification under http://www.w3.org/TR/ .
130 For some of the specifications, the tree under the top-level directory
131 represents the sections of the respective documents, using the section
132 IDs for directory names, with a maximum of three levels deep.
134 So if you're looking for tests in HTML for "The History interface",
135 they will be under `html/browsers/history/the-history-interface/`.
137 Various resources that tests depend on are in `common`, `images`, and
141 If you're looking at a section of the specification and can't figure
142 out where the directory is for it in the tree, just run:
145 node tools/scripts/id2path.js your-id
151 In the vast majority of cases the **only** upstream branch that you
152 should need to care about is `master`. If you see other branches in
153 the repository, you can generally safely ignore them.
158 Save the Web, Write Some Tests!
160 Absolutely everyone is welcome (and even encouraged) to contribute to
161 test development, so long as you fulfill the contribution requirements
162 detailed in the [Contributing Guidelines][contributing]. No test is
163 too small or too simple, especially if it corresponds to something for
164 which you've noted an interoperability bug in a browser.
166 The way to contribute is just as usual:
168 * Fork this repository (and make sure you're still relatively in sync
169 with it if you forked a while ago).
170 * Create a branch for your changes:
171 `git checkout -b topic`.
173 * Run the lint script described below.
174 * Commit locally and push that to your repo.
175 * Send in a pull request based on the above.
180 We have a lint tool for catching common mistakes in test files. You
181 can run it manually by starting the `lint` executable from the root of
182 your local web-platform-tests working directory like this:
188 The lint tool is also run automatically for every submitted pull
189 request, and reviewers will not merge branches with tests that have
190 lint errors, so you must fix any errors the lint tool reports. For
191 details on doing that, see the [lint-tool documentation][lint-tool].
193 But in the unusual case of error reports for things essential to a
194 certain test or that for other exceptional reasons shouldn't prevent
195 a merge of a test, update and commit the `lint.whitelist` file in the
196 web-platform-tests root directory to suppress the error reports. For
197 details on doing that, see the [lint-tool documentation][lint-tool].
199 [lint-tool]: https://github.com/w3c/web-platform-tests/blob/master/docs/lint-tool.md
201 Adding command-line scripts ("tools" subdirs)
202 ---------------------------------------------
204 Sometimes you may want to add a script to the repository that's meant
205 to be used from the command line, not from a browser (e.g., a script
206 for generating test files). If you want to ensure (e.g., for security
207 reasons) that such scripts won't be handled by the HTTP server, but
208 will instead only be usable from the command line, then place them in
211 * the `tools` subdir at the root of the repository, or
213 * the `tools` subdir at the root of any top-level directory in the
214 repository which contains the tests the script is meant to be used
217 Any files in those `tools` directories won't be handled by the HTTP
218 server; instead the server will return a 404 if a user navigates to
219 the URL for a file within them.
221 If you want to add a script for use with a particular set of tests but
222 there isn't yet any `tools` subdir at the root of a top-level
223 directory in the repository containing those tests, you can create a
224 `tools` subdir at the root of that top-level directory and place your
227 For example, if you wanted to add a script for use with tests in the
228 `notifications` directory, create the `notifications/tools` subdir and
229 put your script there.
234 We can sometimes take a little while to go through pull requests
235 because we have to go through all the tests and ensure that they match
236 the specification correctly. But we look at all of them, and take
237 everything that we can.
242 If you wish to contribute actively, you're very welcome to join the
243 public-test-infra@w3.org mailing list (low traffic) by
244 [signing up to our mailing list](mailto:public-test-infra-request@w3.org?subject=subscribe).
245 The mailing list is [archived][mailarchive].
247 Join us on irc #testing ([irc.w3.org][ircw3org], port 6665). The channel
248 is [archived][ircarchive].
250 [contributing]: https://github.com/w3c/web-platform-tests/blob/master/CONTRIBUTING.md
251 [ircw3org]: https://www.w3.org/wiki/IRC
252 [ircarchive]: http://krijnhoetmer.nl/irc-logs/testing/
253 [mailarchive]: http://lists.w3.org/Archives/Public/public-test-infra/
258 * [How to write and review tests](http://testthewebforward.org/docs/)
259 * [Documentation for the wptserve server](http://wptserve.readthedocs.org/en/latest/)