function autoRunJsUnit( runner )
if ( window.location.href.indexOf('cacheBuster') == -1 )
window.location = runner + "?autoRun=true&testPage=" +
Just invoke this function on page load with the path to the testRunner.html and your tests will run automatically.
A quick explanation. When testRunner.html loads the test file, it adds a cacheBuster query parameter to the URL to make sure it gets the latest version of the file (looks like the value is just the unix time, but no matter). Checking for that parameter breaks the infinite redirect loop.
Note to JSUnit developers: If JsUnit is being actively developed (last release an alpha in 2006
), please incorporate something like this into jsUnitCore.js
. Feel free to steal my code if need be.