By Harry Fuecks

Website testing with TestGen4Web and Firefox

By Harry Fuecks

So back again for another round. While “away”, further hair was lost and failed to gain useful employment as a forester. Meanwhile, number 2 child on the way in December. Enough already.

Ran into TestGen4Web today; a Firefox extension (needs 1.5 beta) to help automate testing of web applications, developed by Spikesource, a company making a name for themselves by testing Open Source applications.

Aside from having a slick UML diagram, it adds a toolbar to Firefox to allow recording and playback of “clicks” you’re making as you surf. Once you’re finished recording, you can save the steps as an XML file (format specific to TestGen4Web), for a later re-run.

And re-running isn’t limited only to the Firefox extension. The second half of this project is a code generator which parses the saved XML and generates code for execution either against HTTPUnit (Java), Selenium (more Java) or SimpleTest (PHP). That means it’s easy to re-run the tests on a daily basis via cron, for example.

If you’re now puzzled, a while back Marcus wrote an introduction to SimpleTest’s “Web Testing” capabilities: Coding a Login Box Shouldn’t Hurt – “How Automated Web Tests Can Get Your Development Up To Speed”. More detail can be found in the documentation.

Looking over TestGen4Web’s XML format, it seems to be able to capture most things “GET” and “POST” related (e.g. clicking on links, filling in and submitting forms) as well as being able to test that the response to a request matches expectations, e.g. pull out the contents of a node with an XPath expression and check it matches values captured in “recording”.

Certainly useful to reduce the effort of writing SimpleTest web tests. At the same time I’ve looked at this kind of tool before, such as twill and maxq – have the opinion there’s only so much you can do if you’re not running the tests in a real web browser.

Have a “simple” situation I want to test which goes something like:

  1. User is shown a list of “items”
  2. User clicks on link and get’s a popup providing more info on a single “item” and form for making a “detailed selection”, the form containing significant client side Javascript
  3. On submitting the form, the popup closes and the original window updates to display the detailed selection

While it’s possible to test individual “units” of request and response happening here, with SimpleTest and similar, I don’t see a good way to test the popup or the Javascript contained in the popup – that means there isn’t really a good way to simulate the complete user “transaction” and test it’s working.

Potentially this is something TestGen4Web could solve, given it’s intimacy with the browser (see this question) but you lose the “translation” capability. That said HTTPUnit with help from Rhino, seems to have some support for this – haven’t tried HTTPUnit so no idea how well that works – given the fun we have with browser compatibility, I’m sceptical.

Somehow something based around wxMozilla or Internet Explorer / COM / Python seems more convincing – something that’s a real browser but still executable from the command line. Of course the downside of really solving this problem well is spammers will love it…

The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account