Automating testing with Selenium

How do you complete user testing when the interns are busy and no one has time? Selenium IDE for Firefox.

Selenium IDE is Firefox addon that provides an automated testing tool for websites. Since it runs in the browser it can verify page structure, perform browser actions, and even run through AJAX and js functionality. What makes it really useful in many cases is that it doesn’t necessarily require any programming ability to set up or run test cases. Enough of a background to understand logical functions makes building complicated test cases faster, but isn’t absolutely necessary.

The IDE version allows you to click and step through actions, assertions, and verifications on your site. Even though you will incur a bit of time investment up front to build the test cases, you are not only saving a great deal of time in the long run, you are also establishing consistency for your tests, reducing human error as much as possible. This definitely comes in handy for churning through a site after a contrib module or core update.

The IDE is very easy to extend and there are a ton of great extensions already available. Some of the more useful ones that I’ve come across include:

Logging to a file: https://addons.mozilla.org/en-US/firefox/addon/file-logging-selenium-ide

Highlighting: https://addons.mozilla.org/en-US/firefox/addon/highlight-elements-selenium-id

Adding customized extension is straight-forward. I’ve added a couple, including extending one extension (whoa, meta).

String Comparison with Assert Equals

http://wiki.openqa.org/display/SEL/assertEquals

I figured this one needed the opposite test, so I added:

Selenium.prototype.assertNotEquals = function(elementOne, elementTwo){
    if(elementOne == elementTwo){
        Assert.fail("" + elementOne + " is equal to " + elementTwo);
    }
}

to provide negative comparison.

 

Even fairly simple testing requires some flow control, so this is a useful addition for logical functions:

https://github.com/darrenderidder/sideflow

 

Keep in mind, the IDE is only available in Firefox, but there are third-party plugins to enable the webdriver for other browsers.