/[suikacvs]/webroot/www/webidl2tests/readme.en.html
Suika

Contents of /webroot/www/webidl2tests/readme.en.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sat Oct 11 08:00:26 2008 UTC (16 years, 1 month ago) by wakaba
Branch: MAIN
File MIME type: text/html
++ ChangeLog	11 Oct 2008 07:59:42 -0000
2008-10-11  Wakaba  <wakaba@suika.fam.cx>

	* readme.en.html: New document.

1 <!DOCTYPE HTML>
2 <html lang=en>
3 <title>wttjs &mdash; WebIDL ECMAScript Binding Test Suite Generator</title>
4 <link rel=stylesheet href="http://suika.fam.cx/www/style/html/xhtml">
5 <link rel=license href="#license">
6
7 <h1>wttjs &mdash; WebIDL ECMAScript Binding Test Suite Generator</h1>
8
9 <div class=section id=intro>
10 <h2>What is this?</h2>
11
12 <p><dfn>wttjs</dfn> is a tool to generate automated test suite from an
13 IDL fragment conforming to the WebIDL specification. It generates
14 test cases to check whether the DOM ECMAScript binding of a Web
15 browser conforms to the <a href="#standards">Web IDL specification</a>
16 and the given IDL fragment, as well as a test harness for the
17 automated testing against the generated test cases.
18
19 <p>In addition, a test result submission script is available. Test
20 results can be submitted from the test harness. The browser support
21 matrix for the test suite is automatically generated from the
22 submitted results.
23
24 </div>
25
26 <div class=section id=usage>
27 <h2>Usage</h2>
28
29 <ol>
30
31 <li id=prepare-idl>
32
33 <p>First, prepare an IDL fragment that represents interfaces and
34 exceptions that should be implemented by Web browsers. The IDL
35 fragment must conform to the <a href="#standards">Web IDL
36 specification</a>.
37
38 <p>Ensure that the IDL fragment is conforming. <em>A broken input
39 might generate broken test cases.</em> Use conformance checker such as
40 <a
41 href="http://suika.fam.cx/www/markup/html/whatpm/readme">WebHACC</a>
42 to detect any possible error.
43
44 <li id=prepare-json>
45
46 <p>Prepare a JSON file that contains supplemental information on
47 interfaces and exceptions to be tested. The JSON file can contain two
48 kinds of information: <a href="#instantiate">instantiation
49 instructions</a> and <a href="#crash">crash data</a>.
50
51 <p><dfn id=instantiate>Instantiation instructions</dfn>: Since an IDL
52 fragment does not describe possible ways to instantiate interfaces or
53 exceptions defined in the fragment, it is necessary to tell the script
54 how to create host objects and host exception objects implementing
55 those interfaces and exceptions.
56
57 <p>The JSON file can contain instantiation instruction data as follows:
58 <pre class="json syntax code"><code>
59 {
60 "<var>InterfaceName</var>": [
61 {
62 "id": "<var>create-object-1</var>",
63 "code": "<var>code.to.createObject (1);</var>"
64 }
65 <var>, ...</var>
66 ]
67 <var>, ...</var>
68 }
69 </code></pre>
70
71 <p>... where <var>InterfaceName</var> is the name of the interface or
72 exception as used in the ECMAScript binding,
73 <var>create-object-1</var> is the identifier that distinguish
74 different ways to create an object, and <var>code.to.createObject
75 (1);</var> is a right-hand part of ECMAScript assignment statement to
76 create an object that implements the interface or exception. Note
77 that the identifier (i.e. <var>create-object-1</var>) must be unique
78 for an interface or exception. It must also be unique globally,
79 except when the code (i.e. <var>code.to.createObject (1);</var>) is
80 not different each other.
81
82 <p>For example, the JSON file for an IDL fragment that contains the
83 definition for the <code>NodeList</code> interface would contain:
84
85 <pre class="example json code"><code>
86 {
87 "NodeList": [
88 {
89 "id": "child-nodes",
90 "code": "document.createElement ('p').childNodes;",
91 },
92 {
93 "id": "get-elements",
94 "code": "document.getElementsByTagName ('*');"
95 }
96 ]
97 }
98 </code></pre>
99
100 <p>If the instantiation instruction for an interface or exception is
101 not provided, then any test case that requires an instance of the
102 interface or exception will not be generated.
103
104 <p><dfn id=crash>Crash data</dfn>: A test case sometimes crashes a Web
105 browser. Since the existence of a crashing test case prevents the use
106 of automated test harness, a way to avoid execution of test case that
107 is known to crash a certain browser is provided.
108
109 The crash data can be put into the JSON file with the
110 <code>_crash</code> key as follows:
111
112 <pre class="json syntax code"><code>
113 {
114 <var>... instantiation instruction ...</var>
115 "_crash": {
116 "<var>test-case-id</var>": [
117 "<var>UserAgentNameRegularExpression</var>"
118 <var>, ...</var>
119 ]
120 <var>, ...</var>
121 }
122 }
123 </code></pre>
124
125 <p>... where <var>test-case-id</var> is the identifier of the relevant
126 test case (i.e. the file name of the test case, except for the
127 <code>.html</code> extension) and
128 <var>UserAgentNameRegularExpression</var> is an ECMAScript regular
129 expression, which will be evaluated by ECMAScript
130 <code>new RegExp (<var>regexp</var>)</code> constructor, representing
131 <code>User-Agent</code> strings of Web browsers that are known to
132 crash.
133
134 <li id=execute-wttjs>
135
136 <p>Then, generate the test files by executing the
137 <code>wttjs.pl</code> script as follows:
138
139 <pre>
140 $ <kbd>perl wttjs.pl \
141 --idl-file-name <var>input.idl</var> \
142 --instances-file-name <var>input.json</var> \
143 --test-dir-name <var>output-dir/</var> \
144 --testset-id <var>testname</var></kbd>
145 </pre>
146
147 <p>... where <var>input.idl</var> is the name of the IDL fragment file
148 prepared in <a href="#prepare-idl">Step 1</a>, <var>input.json</var>
149 is the name of the JSON file prepared in <a href="#prepare-json">Step
150 2</a>, <var>output-dir/</var> is the name of the directory in which a
151 directory for the test files is created, and <var>testname</var> is a
152 short identifier for the test suite. For more information on
153 command-line arguments, see <a href="bin/wttjs.html">the documentation
154 for the <code>wttjs.pl</code> script</a>.
155
156 <li>
157
158 <p>At this time, there should be a set of test files for the IDL
159 fragment, in the directory specified as the command-line argument.
160
161 <p>Open <code>all.html</code> in the set by a Web browser that is to
162 be tested. The test is automatically started and the progress is
163 shown in the page until all the tests are done.
164
165 <li id=test-done>
166
167 <p>Examine the test results. Lists of failed tests and skipped tests
168 are shown in the page, as well as the numbers of passed, failed, and
169 skipped tests.
170
171 <p>The test result can be submitted to the <a href="#results">test
172 result form</a> using a submission button that appears in the page.
173
174 </ol>
175
176 </div>
177
178 <div class=section id=results>
179 <h2>Test results</h2>
180
181 <p>Test results can be submitted so that results of Web browsers can
182 be compared.
183
184 <p>A result table can be prepared for each test suite. To create a
185 table, access <code
186 class=uri>&lt;http://suika.fam.cx/gate/test-results/list/<var>testset-id</var>/info></code>,
187 where <var>testset-id</var> is the identifier of the test suite (the
188 one <a href="#execute-wttjs">specified</a> to the
189 <code>wttjs.pl</code> script) and fill in the form.
190
191 <p>Then, submit test results using <a href="#test-done">the submission
192 button in the test harness</a>.
193
194 <p>Finally, access <code
195 class=uri>&lt;http://suika.fam.cx/gate/test-results/list/<var>testset-id</var>/all></code>,
196 which lists the result of various browsers.
197
198 <p>Note that the source code of the server-side script for the test
199 result submission is also <a href="#download">available</a>.
200
201 </div>
202
203 <div class=section id=standards>
204 <h2>Supported standards</h2>
205
206 <p>This script supports:
207
208 <ul>
209
210 <li>ECMA 262 Third Edition.
211
212 <li><a
213 href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/WebIDL/Overview.html?rev=1.96&amp;content-type=text/html;%20charset=utf-8">Web
214 IDL specification, revision 1.96 (3 September 2008 Editor's Draft)</a>.
215
216 </ul>
217
218 <p>Note that the <code>wttjs.pl</code> cannot generate tests for all
219 WebIDL interface/exception constraints. For example, whether an
220 attribute returns a value of IDL type <code>long</code> or not is
221 <em>not</em> tested. Likewise, whether an attribute with extended
222 attribute <code>[Null=Empty]</code> really coverts <code>null</code>
223 to an empty string is <em>not</em> tested, either. Therefore,
224 <em>passing all tests generated by the <code>wttjs.pl</code> script
225 does not necessarily mean the implementation is conforming</em>.
226
227 </div>
228
229 <div class=section id=download>
230 <h2>Download</h2>
231
232 <p>Latest version of scripts are available via the CVS repository:
233
234 <ul>
235
236 <li><a
237 href="http://suika.fam.cx/gate/cvs/webroot/www/webidl2tests/"><code>wttjs.pl</code>:
238 <code>webroot/www/webidl2tests/</code></a> (<a
239 href="http://suika.fam.cx/gate/cvs/webroot/www/webidl2tests/webidl2tests.tar.gz?tarball=1">download
240 tarball</a>).
241
242 <li><a
243 href="http://suika.fam.cx/gate/cvs/webroot/gate/test-results/">result
244 submission: <code>webroot/gate/test-results/</code></a> (<a
245 href="http://suika.fam.cx/gate/cvs/webroot/gate/test-results/test-results.tar.gz?tarball=1">download
246 tarball</a>).
247
248 </ul>
249
250
251 </div>
252
253 <div class=section id=dependency>
254 <h2>Dependency</h2>
255
256 <p>For <code>wttjs.pl</code>: Perl5 or later, <a
257 href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>,
258 and the <code>JSON</code> module. See <a
259 href="bin/wttjs.html#dependency">the document</a> for details.
260
261 <p>For the test result script: CGI-enabled HTTP server, Perl5 or
262 later, and <code>Message::CGI::HTTP</code> and
263 <code>Message::DOM::DOMImplementation</code> modules from the <a
264 href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai-core</a>
265 package.
266
267 </div>
268
269 <div class=section id=example>
270 <h2>Examples</h2>
271
272 <ul>
273
274 <li><a
275 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/tests/webdomcore-20081008/all.html">Web
276 DOM Core WebIDL Conformance</a> (<a
277 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/webdomcore-20081008.idl">IDL</a>,
278 <a
279 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/webdomcore.json">JSON</a>)
280 &mdash; <a
281 href="http://suika.fam.cx/gate/test-results/list/webdomcore-20081008/all">Result
282 Table</a>
283
284 <li><a
285 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/tests/xhr2-20081006/all.html"><code>XMLHttpRequest</code>
286 Level 2 WebIDL Conformance</a> (<a
287 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/xhr2-20081006.idl">IDL</a>,
288 <a
289 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/xhr.json">JSON</a>)
290 &mdash; <a
291 href="http://suika.fam.cx/gate/test-results/list/xhr2-20081006/all">Result
292 Table</a>
293
294 <li><a
295 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/tests/html5-r2321/all.html">HTML5
296 WebIDL Conformance</a> (<a
297 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/html5-r2321.idl">IDL</a>,
298 <a
299 href="http://suika.fam.cx/~wakaba/-temp/test/dom/js-binding/idls/html.json">JSON</a>
300 <em>(incomplete)</em>) &mdash; <a
301 href="http://suika.fam.cx/gate/test-results/list/html5-r2321/all">Result
302 Table</a>
303
304 </ul>
305
306 </div>
307
308 <div class=section id=author>
309 <h2>Author</h2>
310
311 <p><a href="http://suika.fam.cx/~wakaba/who?" rel=author>Wakaba</a>.
312
313 </div>
314
315 <div class=section id=license>
316 <h2>License</h2>
317
318 <p>License of the <em>scripts and documentations</em> (not including
319 generated files) is as follows:
320
321 <blockquote>
322 <p>Copyright 2008 <a
323 href="http://suika.fam.cx/~wakaba/who?">Wakaba</a> <code
324 class=mail>&lt;<a
325 href="mailto:w@suika.fam.cx">w@suika.fam.cx</a>></code>
326
327 <p>This is free software; you can redistribute it and/or modify it
328 under the same terms as Perl itself.
329 </blockquote>
330
331 <p>Note that you may distribute files you generate by these scripts in
332 any license as you like.
333
334 </div>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24