Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Selenium: the in-browser acceptance tool

2006, test

Jason Huggins (from Thoughtworks) gave a talk on Selenium, which is an in-browser JavaScript testing tool for testing web applications. Unlike tools like HttpUnit or HtmlUnit, it doesn't parse HTML and submit results back again; rather, it executes JavaScript inside the browser itself to kick off the tests. This has the advantage that any browser-specific bugs are easily reproducible, and you can get confidence that it works on the browser/operating systems that you have chosen to test against.

There was also a Firefox 'Selenium IDE' for recording interaction with a web browser (though it ran specifically in Firefox). The output script 'seleneese'? can be used to drive other web browers. It's also possible to translate these scripts into other languages (python, Java, JavaScript, C# etc.)

The demo was running on a MacBook with Parallels desktop, using a cut-down Linux/Knoppix distribution called Buildix, which runs Trac, Cruisecontrol and Subversion out of the box. The goal of Buildix is to provide an out-of-the-box project management environment that can run either on a desktop, or alternatively on a virtual system like a Xen or Parallels VM image. Of course, if you're running several different VMs on the same MacBook, you'll need to load it with RAM.

The demo was set up to show Selenium running, so that a modification would kick cruisecontrol off, which in turn would run selenium across many browser configurations (Mac OS X/Safari, Windows/IE, Ubuntu/Firefox) -- all on the same machine. However, as is often the case in such environments, the demo didn't quite work out and we were treated to pre-recorded demos (always a good idea to have pre-canned demos on hand in case the live demo doesn't work out; although, it's also worth checking that you have the network cable plugged in ...)

The other cool thing that the demo used was pyvnc2swf, which uses VNC to record into a SWF (Flash) file for later playback. The demo had setup options to automatically playback and record into a SWF file, and optionally commit it to subversion for later access (though with the size of flash files, it might not make sense to store historic versoins of this file). The video is now available.