Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

watir-webdriver Tests Are Pretty Slow at Sauce Labs OnDemand

with 3 comments

Random Croatian Countryside

Random Croatian Countryside

That Sauce Labs OnDemand thing is pretty nice, but I have noticed something strange. A test suite that takes about 20 minutes to run at my machine, takes 5 hours to run there! Uh-oh. Not what I have expected.

After googling around, and I have found that you can speed up the tests by disabling video, screen shots and advisor. So, I have decided to test how fast are the tests with default settings and with everything disabled.

This simple script visits a few pages. In my test it visits 9 client sites. You can visit top 10 sites, for example, if you want to run the test yourself.

require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.new
sites = [
  "google.com",
  "facebook.com",
  # add more sites
]
sites.each do |site|
  browser.goto site
end
browser.close

Run the script 10 times (or more, if you have the time) to make the results at least a bit statistically significant. Measure the time it takes to run the script at your machine and at Sauce Labs OnDemand, with various operating system and browser combinations.

I got this results.

The script that just opens the browser, visits 9 pages and closes the browser takes 14 seconds on average at my machine. Exactly the same script at Sauce Labs OnDemand takes on average 55-69 seconds with default settings, and 48-64 seconds with everything disabled. So, the script is a bit faster when everything is disabled, but unfortunately, just a bit.

The entire script is here:

You have to replace username and api-key with your username and API key.

The only solution I have found so far is to run the tests in parallel. Report coming soon.

Written by Željko Filipin

May 26th, 2012 at 7:45 pm

Posted in Watir

Tagged with , ,

watir-webdriver and Sauce Labs OnDemand

with 3 comments

Bug Hunter's Journal

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 => "http://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.

testing this cloud thing

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 , ,

Viaqa 12 Teaser Podcast

with 2 comments

Random hipster photo

Random hipster photo.

A few days ago I was one of the gests at Viaqa 12 teaser podcast (in Croatian). Viaqa is Croatian software testing conference. Crappy name, but great conference! :) (Last year I was one of the organizers, so I am a bit biased.)

This is the third viaqa conference. The first one was viaqa 10 in Osijek, the second one was viaqa 11 in Zagreb and the third, viaqa 12, will be in Varaždin. I hope to see you there.

Written by Željko Filipin

May 23rd, 2012 at 6:01 pm

Posted in Events,Podcasts

Tagged with , ,