HTTP Auth and Selenium

I'm starting to look at Selenium-RC at work today. We're moving a lot of web based functional tests away from PBP.

I ran into a major problem straight away. Our web interface uses Basic HTTP Auth and Firefox insists on presenting a dialog to the (non-existent) user when you open a style URL. The tests would hang waiting for the Ok button click.

After a lot of searching I finally found the network.http.phishy-userpass-length. option. When set to 255 the authentication warning dialog box isn't shown.

Selenium creates a fresh Firefox profile every time it starts Firefox so modifying the option in about:config doesn't help. You need to edit firefox.js and add a line like pref("network.http.phishy-userpass-length", 255);. This ensures that the option is set in any new profile. On Windows firefox.js can probably be found at Program Files\Mozilla Firefox\defaults\prefs\firefox.js. It'll probably be at /usr/lib/firefox-*/defaults/pref/firefox.js on a Linux machine.

I wonder if Selenium-RC could set this option in profiles it creates itself? It already seems to set a bunch of other options.

posted: Tue, 07 Nov 2006 01:58 | permalink | comments

Selenium at London 2.0

I went to the regular London 2.0 meetup last night. Great people, interesting conversations and a little too much beer.

One of the Selenium developers, Jason Huggins demoed Selenium and Selenium-IDE on a Macbook notebook running the Parallels virtual machine software. He had several virtual machines running different platforms including Ubuntu Linux, Windows XP and Mac OS X with different browsers on each. Testing was triggered by checking in code to the SVN repository of Buildix virtual machine also running on the laptop.

When a check-in occurs the code is automagically tested on the browsers running on each of the browsers running on the different platforms in each virtual machine. The beauty of selenium is that the tests run inside the browser so your interface is tested just as it is used. All your JavaScript runs and works as for the end user. I loved the fact that all the browser sessions are captured to a Flash movie so that if a test fails you can watch the footage of the steps leading up to the failure.

The crux Jason's demo was that you could have a complete multiplatform web application test system running on a bottom level Macbook laptop (with extra RAM). The machine appeared to run very quickly despite the 5 or 6 VMs that were running. Jason mentioned that if you don't care about Mac browser testing (Safari) then you could set up a similar system using VMWare or Xen on Linux or Windows.

Selenium-IDE also looks seriously cool. It's a Firefox plugin that provides a complete environment for developing test cases. It can record your steps as you use a web interface and output to a variety of test script formats including a HTML stype sequential output, Python and Ruby. If using Python or Ruby scripts you can use all the features of the language such as conditions and loops. Selenium-IDE is going to make developing effective complete web tests so much easier (and fun!).

We need to start looking at this where I work. Our current web interface tests use Twill which works ok but has many shortcomings. Creating test cases is tedious, the JavaScript parts of the UI aren't tested at all and there's no testing of cross-browser support. Our UI is using more and more JavaScript so something like Selenium is going to become vital. I'm looking forward to using it.

posted: Wed, 06 Sep 2006 09:47 | permalink | comments