Fun with Selenium

Cross your fingers and hope nothing goes wrong. That’s what usually happens in web-software development. After all, who really has time to test an almost infinite combination of browsers, versions, OSes and devices? Testing is expensive and time consuming. We want our products out the door, not stuck in endless testing phases. The problem with this way of thinking is that it almost always goes wrong, but there’s a solution that can help, it’s called Selenium.

Selenium is a collection of tools that let you record, write and run automated tests in real web browsers on real computers. You basically give it a script: “go to this page, click this, enter this text there, click that”, etc. Then, at each step, you check to see if the result was correct: “Are the appropriate elements on the page? Did that element appear when I clicked there?” etc. These tests scripts are saved and can be re-run every time you make a change to your application. Now just sit back and wait to see if anything breaks before you launch. It’s awesome. Selenium v2 (which is currently in alpha) is adding even more awesomeness by merging with Google’s WebDriver to offer expanded browser coverage and more features. You should really check it out.

If you’re anything like me you probably have a few old computers lying around. If you do, why not put them to use and build yourself a nice little Selenium testing setup? With minimal effort I spent a day reading through the Selenium documentation and building and configuring several servers from surplus hardware we had lying around the office.

Selenium Servers

Now I have several Windows machines with various versions of all the major browsers. A big portion of what I do is mobile so I threw in a few Android devices, some BlackBerry’s and and iPhone (note the elastics are temporary, I need to invest in some Velcro) along with several running as emulators on one of the machines. Now I just write a few tests, hit run, and wait to see if any of the 20 or so browser/device combinations fails. Like wise when someone inevitably finds a bug, I can re-create a test for it, fix it, and be confident in the future that the bug won’t re-appear (that probably would have helped Twitter or Facebook recently).

It takes a little time for the tests to run but now I’m free to do other things–like enjoy life–instead of manually testing the same things over and over and over and over again.

The post ‘Fun with Selenium ’ was first published by Jeffrey Sambells on