W3C home > Mailing lists > Public > www-dom-ts@w3.org > April 2002

jsUnit, Cross Browser Support, Asynchronous Data

From: Robert Clary <bclary@netscape.com>
Date: Mon, 01 Apr 2002 11:00:21 -0500
Message-ID: <3CA88415.7090401@netscape.com>
To: edward@jsunit.net
CC: www-dom-ts@w3.org
Edward,

I would appreciate your feedback on http://bclary.com/jsunit-modified.html

The goal was to allow any browser which supports HTML 4.01 and 
ECMAScript 262-3rd Edition to be able to use jsUnit.

The use of IE/NS6 only features such as innerHTML have been removed and 
the requirement to support document.getElementById has also been 
removed. To do this, I replaced the parts of the user interface which 
required updating with FRAMEs and used document.write to update the 
contents instead of HTMLElement.innerHTML. As a part of this 
modification, the script which updates the user interface has been moved 
into UiUpdater.js.

This was done to extend the range of browsers which could use jsUnit. 
This is important for jsUnit's use in the DOM TS.

I also modified the runTest method to allow the calling of an 
asynchronous preTest() function in test cases before any tests are 
performed in a test document. The reason for this modification was to 
allow test pages to load external documents asynchronously before 
running any tests.

Other modifications include addition of DOCTYPEs, and changes in markup 
for validation purposes.

The modified jsUnit runs all of the standard tests provided with the 
original jsUnit 1.2.6 on Internet Explorer 5.5 and Netscape 6/Mozilla 
0.9.9+ on Windows 2000. Unfortunately it appears Opera still has 
problems changing the contents of frames so it times out attempting to 
load the test documents. I have reports that IE 5.13 on Macintosh does 
not run the tests. I believe this may be due to the method of test 
function discovery.  I have not tested with other browsers yet but will 
be soliciting feedback from the members of the DOM TS community.

Some items I am considering but not have done yet are:

Exposure of timeout parameters through the user interface

Ability to continue to attempt to load a test case even after a time out.

Both of these changes would be useful for when the tests are hosted on 
the network and the user has a slow connection. I have already done this 
in the runTest method for the preTest().

I am also considering modifying the means by which test functions in a 
test document are exposed. While using the convention that the names of 
all test functions begin with "test" is convenient, it appears that this 
may limit the ability of other browsers such as IE 5.13 on Macintosh 
from using jsUnit. It seems that an easy approach would be to expose the 
test functions in an array which could be queried by jsUnit. This would 
eliminate this dependency and perhaps allow more browsers to use jsUnit.

I hope that you find these modifications appropriate and would consider 
working with me to introduce these and perhaps some additional 
modifications into the official release of jsUnit.

Bob
-- 
Bob Clary, bclary@netscape.com
Technology Evangelist, Netscape Communications
http://developer.netscape.com/evangelism/
Received on Monday, 1 April 2002 11:01:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 6 April 2009 12:58:46 GMT