Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

watir-webdriver and Sauce Labs OnDemand

with 2 comments

spacer

Bug Hunter's Journal

For a couple of clients I have been running watir-webdriver tests using Sauce Labs OnDemand. Never heard about it? In short, instead of driving a browser at your local machine, you can drive a browser in the cloud. Sounds cool, right?

What changes should you do to your existing watir-webdriver scripts to run them in the cloud?

This would open Firefox at your local machine:

require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.new :firefox

And this would open Firefox at Sauce Labs OnDemand:

require "watir-webdriver"
caps = Selenium::WebDriver::Remote::Capabilities.firefox
caps.version = "11"
caps.platform = :LINUX
caps[:name] = "testing this cloud thing"
browser = Watir::Browser.new(
  :remote,
  :url => "username:api-key@ondemand.saucelabs.com:80/wd/hub",
  :desired_capabilities => caps)

You have to replace username and api-key with your username and API key. If you do not have saucelabs.com account, you can get one for free. Free account has limitation of 200 minutes of driving a browser per month, but that is more than enough to try.

You can run the above code by pasting it into IRB, or paste it into a Ruby file (named cloud.rb, for example) and just run the file from command line.

After the browser is opened, you can drive it as usual.

Now go to https://saucelabs.com/jobs and there should be a test with status running and name testing this cloud thing.

spacer

testing this cloud thing

Click the test name and you will see live video of the browser running in the cloud. After the test is finished you will be able to view the video and see the screenshots that (I think) are automatically taken for every page that the browser opens.

Written by Željko Filipin

May 26th, 2012 at 6:56 pm

Posted in Watir

Tagged with code, Sauce Labs OnDemand, watir

« Viaqa 12 Teaser Podcast
watir-webdriver Tests Are Pretty Slow at Sauce Labs OnDemand »

2 Responses to 'watir-webdriver and Sauce Labs OnDemand'

Subscribe to comments with RSS or TrackBack to 'watir-webdriver and Sauce Labs OnDemand'.

  1. [...] Sauce Labs OnDemand thing is pretty nice, but I have noticed something strange. A test suite that takes about 20 [...]

    spacer

    watir-webdriver Tests Are Pretty Slow at Sauce Labs OnDemand at Željko Filipin's Blog on Software and Testing

    26 May 12 at 7:45 pm

  2. [...] few days ago I wrote about how to run watir-webdriver tests at Sauce Labs OnDemand. I have also noticed that watir-webdriver tests are pretty slow at Sauce Labs [...]

    spacer

    watir-webdriver tests at TestingBot at Željko Filipin's Blog on Software and Testing

    31 May 12 at 4:19 pm

Leave a Reply

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.