Friday, December 18, 2009

Using Sauce OnDemand To Run Automated Cross-Browser Tests In The Cloud

Update:  What has the original creator of Selenium (Jason Huggins) been cooking up lately? Hint: it has to do with Sauce.

Jason and his colleagues at Sauce Labs have been very busy since last we wrote about their product offerings.  They've renamed their cloud-hosted service to Sauce OnDemand (formerly called "SauceRC") and announced a Sauce Labs enhanced version of Selenium RC (versions for both PC and Mac) which they are calling Sauce RC. To find out more about Sauce RC, here's a link to a screencast video that describes the product and how to get started using it.

August 21, 2009 8:00AM PDT
In May we wrote an article about a service we discovered called Sauce OnDemand (formerly called "SauceRC") from Sauce Labs (Selenium RC In The Cloud - SauceRC). We found this service interesting because it allows you to do browser compatibility testing without the hassle (let alone cost and energy) of configuring local machines and installing browsers. Instead, you push your tests into the Sauce Labs cloud. Simply create test scripts using the Selenium IDE plug-in for FireFox, designate the browser you want to test on (see code below) and let Sauce OnDemand do all the work. Repeat for each browser you want to test on, then go to the Sauce Labs website to retrieve the results. And the cool part is that you get a movie, as shown in the graphic above, of an actual browser session running your tests. Talk about convenience!


It's best if you know how to use Selenium RC before you start using Sauce OnDemand, but, according to the developer, some customers have successfully used the service without previous use of Selenium RC.  In our case, we had already written scripts for Selenium RC, so it was simply a matter of changing 1 line in our script using the code below:

DefaultSelenium selenium = new DefaultSelenium(
                "saucelabs.com",
                4444,
                "{\"username\": \"rvizzone\"," +
                "\"access-key\": \"xxxxxxxxxxxxxxxxxxx\"," +
                "\"os\": \"Windows 2003\"," +
                "\"browser\": \"firefox\"," +
                "\"browser-version\": \"3.\"}",
                "http://www.google.com/");
Note the browser and version designated in red.

After we made this change, our scripts ran as they had using Selenium RC on our localhost, with the actually processing taking place at Sauce Labs, and the results, both a movie and log, available to use anytime through links accessible through our Sauce Labs account.

Here's a set of high-level HOWTO steps for using Sauce OnDemand:
1. Record and edit your test script with the Selenium IDE plug-in for Firefox.
2. Export your script and make sure it runs with Selenium RC on your localhost.
3. Make the 1 line change to your script that includes your user name, access key, etc., as shown above.
4. Now run the script again (which will now be directed to the Sauce OnDemand server).
5. Retrieve results from with your Sauce Labs account
If you're looking for your investment in Selenium to pay off even more, I suggest you try Sauce OnDemand. Sauce Labs offers both a subscription plan and pre-paid minutes. And if you sign up during their public beta program, the minutes you buy will be doubled, e.g. buy 250 minutes for $10 and you'll get 250 minutes free.

0 comments. Add Comment.: