W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

[selectors-api] Test Suite

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Fri, 04 Jul 2008 14:58:06 +0200
Message-ID: <486E1E5E.1020705@lachy.id.au>
To: public-webapps <public-webapps@w3.org>

Hi,
   I've made some progress on the test suite.  I now have a framework 
written for it to support the tests, though it's not yet entirely complete.

http://dev.w3.org/2006/webapi/selectors-api-testsuite/
http://dev.w3.org/cvsweb/2006/webapi/selectors-api-testsuite/

It's designed to have each test as an individual function, each of which 
is stored in an array.  The framework then invokes each one individually 
and records the result.

The framework allows each test to make one or more assertions using 
either ts.assert() or ts.assertEquals().  (This is somewhat based on the 
way the acid3 test was written).

assert() accepts a condition that evaluates as either true or false, and 
an error message to be used if the condition evaluates to false.

assertEquals() accepts an expression, expected value and error message, 
and the expression is checked for equality against the expected value.

Each test function needs to indicate success or failure, or that it 
needs to try again.  The expected return values are:

* true - the test passed
* false - the test is incomplete and needs to try again
* throws an exception - the test failed

(The assert functions will throw the exception if the given condition 
evaluates to false.)

If the test is incomplete, the framework will repeatedly run the test 
after a short delay, using setTimeout(), until it either indicates 
success or failure, or until it times out after 500 attempts.

I'm planning to add some utility functions to the framework for use by 
testcases to, for example, load external resources into an iframe.

Let me know if you have any suggestions for improvement.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Friday, 4 July 2008 12:58:46 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:27 GMT