Challenges in testing ‡biblios
Sunday, September 14th, 2008 by Chris CatalfoLately I’ve been looking into use Selenium and JsUnit to test Biblios. Selenium is designed to allow functional testing of web applications, while JsUnit is a unit test framework for Javascript applications.
There are some challenges to using each of these testing tools because of Biblios’ architecture and heavy use of AJAX. One way to use Selenium is termed Selenium Remote Control. This sets up a proxy server and starts a browser instance which connects to the proxy server; the proxy server forwards requests to the site being tested and reports back to the test script the results. One problem for Biblios in this approach is that the browser instance run by Selenium Remote Control must have the Google Gears extension installed in order to work. This takes a little work to set up, or a custom profile in the case of Firefox.
A challenge in using JsUnit is that JsUnit provides no way to wait until specified conditions occur before executing a test. This is necessary in Biblios because certain tests cannot be run until the application is fully loaded, which happens through the use of AJAX calls after the html/js/css of the index.html page is loaded. So JsUnit starts running its tests before Biblios is really ready for them. Luckily, Selenium does provide a means of waiting for specified conditions before executing tests.
Still another challenge in testing Biblios is that Biblios’ html is nearly entirely generated by the ExtJS javascript framework. This makes identifying elements to test a challenge because in many cases the html elements have no systematic id attribute to rely upon.
