1 The Web Platform Tests Project [![IRC chat](https://goo.gl/6nCIks)](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. Writing tests in a
6 way that allows them to be run in all browsers gives browser projects
7 confidence that they are shipping software that is compatible with other
8 implementations, and that later implementations will be compatible with
9 their implementations. This in turn gives Web authors/developers
10 confidence that they can actually rely on the Web platform to deliver on
11 the promise of working across browsers and devices without needing extra
12 layers of abstraction to paper over the gaps left by specification
13 editors and implementors.
18 The tests are designed to be run from your local computer. The test
19 environment requires Python 2.7+ (but not Python 3.x). You will also
20 need a copy of OpenSSL. Users on Windows should read the
21 [Windows Notes](#windows-notes) section below.
23 To get the tests running, you need to set up the test domains in your
24 [`hosts` file](http://en.wikipedia.org/wiki/Hosts_%28file%29%23Location_in_the_file_system). The
25 following entries are required:
28 127.0.0.1 web-platform.test
29 127.0.0.1 www.web-platform.test
30 127.0.0.1 www1.web-platform.test
31 127.0.0.1 www2.web-platform.test
32 127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
33 127.0.0.1 xn--lve-6lad.web-platform.test
36 Because web-platform-tests uses git submodules, you must ensure that
37 these are up to date. In the root of your checkout, run:
40 git submodule update --init --recursive
43 The test environment can then be started using
49 This will start HTTP servers on two ports and a websockets server on
50 one port. By default one web server starts on port 8000 and the other
51 ports are randomly-chosen free ports. Tests must be loaded from the
52 *first* HTTP server in the output. To change the ports, edit the
53 `config.json` file, for example, replacing the part that reads:
56 "http": [8000, "auto"]
59 to some port of your choice e.g.
65 If you installed OpenSSL in such a way that running `openssl` at a
66 command line doesn't work, you also need to adjust the path to the
67 OpenSSL binary. This can be done by adding a section to `config.json`
71 "ssl": {"openssl": {"binary": "/path/to/openssl"}}
74 <span id="windows-notes">Windows Notes</span>
75 =============================================
77 Running wptserve with SSL enabled on Windows typically requires
78 installing an OpenSSL distribution.
79 [Shining Light](http://slproweb.com/products/Win32OpenSSL.html)
80 provide a convenient installer that is known to work, but requires a
83 After installation ensure that the path to OpenSSL is on your `%Path%`
86 Then set the path to the default OpenSSL configuration file (usually
87 something like `C:\OpenSSL-Win32\bin\openssl.cfg` in the server
88 configuration. To do this copy `config.default.json` in the
89 web-platform-tests root to `config.json`. Then edit the JSON so that
90 the key `ssl/openssl/base_conf_path` has a value that is the path to
91 the OpenSSL config file.
97 There is a test runner that is designed to provide a
98 convenient way to run the web-platform tests in-browser. It will run
99 testharness.js tests automatically but requires manual work for
100 reftests and manual tests.
102 The runner can be found at `/tools/runner/index.html` on the local
106 http://web-platform.test:8000/tools/runner/index.html
109 in the default configuration. The first time you use this it has to
110 generate a manifest of all tests. This may take some time, so please
116 The master branch is automatically synced to http://w3c-test.org/.
118 Pull requests that have been checked are automatically mirrored to
119 http://w3c-test.org/submissions/.
124 Each top-level directory represents a W3C specification: the name
125 matches the shortname used after the canonical address of the said
126 specification under http://www.w3.org/TR/ .
128 For some of the specifications, the tree under the top-level directory
129 represents the sections of the respective documents, using the section
130 IDs for directory names, with a maximum of three levels deep.
132 So if you're looking for tests in HTML for "The History interface",
133 they will be under `html/browsers/history/the-history-interface/`.
135 Various resources that tests depend on are in `common`, `images`, and
139 If you're looking at a section of the specification and can't figure
140 out where the directory is for it in the tree, just run:
143 node tools/scripts/id2path.js your-id
149 In the vast majority of cases the **only** upstream branch that you
150 should need to care about is `master`. If you see other branches in
151 the repository, you can generally safely ignore them.
156 Save the Web, Write Some Tests!
158 Absolutely everyone is welcome (and even encouraged) to contribute to
159 test development, so long as you fulfill the contribution requirements
160 detailed in the [Contributing Guidelines][contributing]. No test is
161 too small or too simple, especially if it corresponds to something for
162 which you've noted an interoperability bug in a browser.
164 The way to contribute is just as usual:
166 * Fork this repository (and make sure you're still relatively in sync
167 with it if you forked a while ago).
168 * Create a branch for your changes:
169 `git checkout -b topic`.
171 * Run the lint script described below.
172 * Commit locally and push that to your repo.
173 * Send in a pull request based on the above.
178 We have a lint tool for catching common mistakes in test files. You
179 can run it manually by starting the `lint` executable from the root of
180 your local web-platform-tests working directory like this:
186 The lint tool is also run automatically for every submitted pull
187 request, and reviewers will not merge branches with tests that have
188 lint errors, so you must fix any errors the lint tool reports. For
189 details on doing that, see the [lint-tool documentation][lint-tool].
191 But in the unusual case of error reports for things essential to a
192 certain test or that for other exceptional reasons shouldn't prevent
193 a merge of a test, update and commit the `lint.whitelist` file in the
194 web-platform-tests root directory to suppress the error reports. For
195 details on doing that, see the [lint-tool documentation][lint-tool].
197 [lint-tool]: https://github.com/w3c/web-platform-tests/blob/master/docs/lint-tool.md
199 Adding command-line scripts ("tools" subdirs)
200 ---------------------------------------------
202 Sometimes you may want to add a script to the repository that's meant
203 to be used from the command line, not from a browser (e.g., a script
204 for generating test files). If you want to ensure (e.g., for security
205 reasons) that such scripts won't be handled by the HTTP server, but
206 will instead only be usable from the command line, then place them in
209 * the `tools` subdir at the root of the repository, or
211 * the `tools` subdir at the root of any top-level directory in the
212 repository which contains the tests the script is meant to be used
215 Any files in those `tools` directories won't be handled by the HTTP
216 server; instead the server will return a 404 if a user navigates to
217 the URL for a file within them.
219 If you want to add a script for use with a particular set of tests but
220 there isn't yet any `tools` subdir at the root of a top-level
221 directory in the repository containing those tests, you can create a
222 `tools` subdir at the root of that top-level directory and place your
225 For example, if you wanted to add a script for use with tests in the
226 `notifications` directory, create the `notifications/tools` subdir and
227 put your script there.
232 We can sometimes take a little while to go through pull requests
233 because we have to go through all the tests and ensure that they match
234 the specification correctly. But we look at all of them, and take
235 everything that we can.
240 If you wish to contribute actively, you're very welcome to join the
241 public-test-infra@w3.org mailing list (low traffic) by
242 [signing up to our mailing list](mailto:public-test-infra-request@w3.org?subject=subscribe).
243 The mailing list is [archived][mailarchive].
245 Join us on irc #testing ([irc.w3.org][ircw3org], port 6665). The channel
246 is [archived][ircarchive].
248 [contributing]: https://github.com/w3c/web-platform-tests/blob/master/CONTRIBUTING.md
249 [ircw3org]: https://www.w3.org/wiki/IRC
250 [ircarchive]: http://krijnhoetmer.nl/irc-logs/testing/
251 [mailarchive]: http://lists.w3.org/Archives/Public/public-test-infra/
256 * [How to write and review tests](http://testthewebforward.org/docs/)
257 * [Documentation for the wptserve server](http://wptserve.readthedocs.org/en/latest/)