Fully namespaced, debuggable unit tests

Anastasia Cheetham a.cheetham at utoronto.ca
Thu Feb 28 15:29:51 UTC 2008

On 24-Feb-08, at 3:13 PM, Colin Clark wrote:

> the least broken amongst them seems be--
> no surprise here--the one written by John Resig for testing jQuery. I
> had a fairly painless time porting my tests to this framework, which
> I've dubbed "jqUnit."

I have begun to look at porting our existing tests over to this  

Some observations (so far):

1) The "jQuery.noConflict()" call we use to avoid conflicts with other  
javascript toolkits causes the new testrunner to fail. The testrunner  
relies on the existence of '$', and the noConflict() call eliminates  

I googled this, and the only suggestion was to rewrite testrunner.js  
to avoid using the $ shorthand. Doing so does, indeed, fix the  
problem. I'm not sure of the status of testrunner.js, where Colin got  
it, or whether or not we can feel free to modify it without having to  
deal with merging our changes with external updates to the file.

2) The tests are run by simply loading the test HTML file (which  
contains the mark-up that the test work on) in a browser, and the  
results of the tests are 'injected' into a placeholder in the test file.

Currently, our Lightbox 'test file' is also our template, and our  
demonstration file. When I added the necessary changes to the HTML  
file, loading it into the browser did successfully run the tests, but  
then the test results were listed along with the grid of images, which  
is not necessarily what we want if the goal happens to be to  
demonstrate the Lightbox rather than run the tests.

One option is to separate the notion of demonstration file/template  
from test data, and use a separate (albeit almost identical) html file  
for testing purposes. I don't like the idea of identical files lying  

I haven't yet come up with other options :-)

I am moving on to porting the actual tests...

Anastasia Cheetham                   a.cheetham at utoronto.ca
Software Designer, Fluid Project           fluidproject.org
Adaptive Technology Resource Centre / University of Toronto

More information about the fluid-work mailing list