W3C home > Mailing lists > Public > public-webapps-testsuite@w3.org > December 2012

Re: Adding WebSocket and WebWorker test suites to testing framework

From: James Graham <jgraham@opera.com>
Date: Mon, 03 Dec 2012 12:42:58 +0100
Message-ID: <50BC9042.1050906@opera.com>
To: Kris Krueger <krisk@microsoft.com>
CC: Arthur Barstow <art.barstow@nokia.com>, Simon Pieters <simonp@opera.com>, "public-webapps-testsuite@w3.org" <public-webapps-testsuite@w3.org>
On 12/01/2012 09:15 AM, Kris Krueger wrote:
> Please provide pointers :)

Well I really meant "answers to specific questions". Everything that 
I've done is checked in to the WebApps repo.

You can tell tests that have not been converted yet because they still 
contain a call to end(). *Possibly* some of the converted tests stil try 
to use an incorrect port, but I'm not sure.

The process for converting the tests is basically:
a) Possibly replace test with async_test
b) Update the port to match the W3C server
c) Replace any old-framework asserts that remain (identified as 
assertCamelCase) with the correct testharness.js assert
d) Ensure that the flow for the test is correct and that any async parts 
are wrapped in step_func.
e) Replace end() with t.done() or similar.

So for example 
http://dvcs.w3.org/hg/webapps/file/8297f95f9f20/WebSockets/tests/submissions/Opera/binary/001.html 
might become

<!doctype html>
<title>WebSockets: Send/Receive blob, blob size less than network array 
buffer</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../constants.js></script>
<div id=log></div>
<script>
async_test(function(t){
   var ws = new WebSocket(SCHEME_AND_DOMAIN+':8007/echo');
   var data = "";
   var datasize = 10;
   ws.onopen = t.step_func(function(e) {
    ws.binaryType = "blob";
    data = new ArrayBuffer(datasize);
    ws.send(data);
   } )
   ws.onmessage = t.step_func(function(e) {
     assert_true(e.data instanceof Blob);
     assert_equals(e.data.size, datasize);
     t.done();
   } )

});
</script>

(I didn't check the port number, so that might not be quite right. And 
using assert_true is really ugly. Nut I hope it is enough to give you 
the idea).
Received on Monday, 3 December 2012 11:44:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 22 April 2014 14:15:59 UTC