gecko-dev/testing/web-platform/tests/docs/test-templates.md
James Graham 579d122b35 Bug 1183628 - Update web-platform-tests to revision 593fd27931d7e9d573d2796fe10df9fff778d56f, a=testonly
--HG--
rename : testing/web-platform/tests/FileAPI/progress.html => testing/web-platform/tests/FileAPI/progress-manual.html
rename : testing/web-platform/tests/html/semantics/scripting-1/the-template-element/testcommon.js => testing/web-platform/tests/html/resources/common.js
rename : testing/web-platform/tests/webstorage/iframe/event_body_handler.html => testing/web-platform/tests/webstorage/resources/event_body_handler.html
rename : testing/web-platform/tests/webstorage/iframe/event_setattribute_handler.html => testing/web-platform/tests/webstorage/resources/event_setattribute_handler.html
rename : testing/web-platform/tests/webstorage/iframe/local_change_item_iframe.html => testing/web-platform/tests/webstorage/resources/local_change_item_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/local_set_item_clear_iframe.html => testing/web-platform/tests/webstorage/resources/local_set_item_clear_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/local_set_item_iframe.html => testing/web-platform/tests/webstorage/resources/local_set_item_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/local_set_item_remove_iframe.html => testing/web-platform/tests/webstorage/resources/local_set_item_remove_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/session_change_item_iframe.html => testing/web-platform/tests/webstorage/resources/session_change_item_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/session_set_item_clear_iframe.html => testing/web-platform/tests/webstorage/resources/session_set_item_clear_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/session_set_item_iframe.html => testing/web-platform/tests/webstorage/resources/session_set_item_iframe.html
rename : testing/web-platform/tests/webstorage/iframe/session_set_item_remove_iframe.html => testing/web-platform/tests/webstorage/resources/session_set_item_remove_iframe.html
2015-07-14 14:39:06 +01:00

3.0 KiB

This page contains templates for creating tests. The template syntax is compatible with several popular editors including TextMate, Sublime Text, and emacs' YASnippet mode.

Each template is given in two forms, one minimal and one including extra metadata. Usually the metadata is required by CSS tests and optional for other tests.

Templates for filenames are also given. In this case {} is used to delimit text to be replaced and # represents a digit.

Reftests

Minimal Reftest

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Test title}</title>
<link rel="match" href="${2:URL of match}">
<style>
    ${3:Test CSS}
</style>
<body>
    ${4:Test content}
</body>

Filename: {test-topic}-###.html

Reftest Including Metadata

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Test area}: ${2:Scope of test}</title>
<link rel="author" title="${3:Author's name}" href="${4:Contact link}">
<link rel="help" href="${5:Link to tested section}">
<link rel="match" href="${6:URL of match}">
<meta name="flags" content="${7:Requirement flags}">
<meta name="assert" content="${8:Description of what you're trying to test}">
<style>
    ${9:Test CSS}
</style>
<body>
    ${10:Test content}
</body>

Filename: {test-topic}-###.html

Minimal Reftest Reference:

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Reference title}</title>
<style>
    ${2:Reference CSS}
</style>
<body>
    ${3:Reference content}
</body>

Filename: {description}.html or {test-topic}-###-ref.html

Reference Including Metadata

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Reference title}</title>
<link rel="author" title="${2:Author's name}" href="${3:Contact link}">
<style>
    ${4:Reference CSS}
</style>
<body>
    ${5:Reference content}
</body>

Filename: {description}.html or {test-topic}-###-ref.html

testharness.js tests

Minimal Script Test

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Test title}</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
${2:Test body}
</script>

Filename: {test-topic}-###.html

Script Test With Metadata

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Test title}</title>
<link rel="author" title="${2:Author's name}" href="${3:Contact link}">
<link rel="help" href="${4:Link to tested section}">
<meta name="flags" content="${5:Requirement flags}">
<meta name="assert" content="${6:Description of what you're trying to test}">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
${7:Test body}
</script>

Filename: {test-topic}-###.html

Manual Test

<!DOCTYPE html>
<meta charset="utf-8">
<title>${1:Test title}</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({explicit_timeout: true});
${2:Test body}
</script>

Filename: {test-topic}-###-manual.html