Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Freelance Software Tester

without comments

Random photo: balls.

Random photo: balls.

It is official now. I have started a company that will focus on software testing. Yesterday I have finally completed all paperwork. At the moment I have three clients and I am not looking for work.

This is the last post here. It is cross-posted from my new site filipin.eu. I will move everyhing from this blog there. All new content will be posted there. There is no need to update feed, it should be the same. Please let me know if you notice any problems.

Written by Željko Filipin

June 15th, 2012 at 1:20 pm

Posted in Testing

page-object API should be more similar to watir API

with one comment

Random photo: Rijeka, Croatia.

Random photo: Rijeka, Croatia.

I have just created issue 102 for page-object gem. After I wrote it, I thought it would be a good blog post too, so I am reposting it here. If you agree, or not, please comment at GitHub issue, not here.


I am pretty sure I am not the only one that has experience with watir API, and gets confused because page-object gem uses different names for some page elements.

Examples:

HTML watir page-object
td td cell
hidden hidden hidden_field
img img image
a a link
li li list_item
ol ol ordered_list
p p paragraph
input type=”radio” radio radio_button
select select select_list
td td cell
textarea textarea text_area
ul ul unordered_list

I am all for making the API human-friendly, that is what watir tried to do in the beginning. After a few years we have noticed that people are getting confused with the API that sometimes uses the same names as HTML, and sometimes does not.

I would suggest that you leave the existing API as is and to create aliases for the people that are familiar with HTML and watir APIs.

Example: we should be able to access unordered list with both unordered_list and ul.

For more people thinking page-object API should be more similar to watir API, take a look at Alister’s Roll your own page objects blog post (and comments).

Written by Željko Filipin

June 12th, 2012 at 12:30 pm

Posted in Software

Tagged with ,

watir-webdriver tests at TestingBot

with 4 comments

Random photo: Varaždin, Croatia.

Random photo: Varaždin, Croatia.

To make it explicit: I am not affiliated with TestingBot or Sauce Labs.

A 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 OnDemand.

Jari Bakken suggested to use net-http-persistent gem to speed things up. Jochen Delabie suggested I should try TestingBot. So, I have decided to try both.

TestingBot is pretty much the same service as Sauce Labs OnDemand. There is also 200 minutes of free trial, and the prices are a bit lower than Sauce Labs OnDemand. If you have used Sauce Labs OnDemand, TestingBot will look familiar. If you have not used Sauce Labs OnDemand, read the last couple of articles I have wrote here.

So, what you need to do to run your tests at TestingBot?

If you already run tests 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 only have to change caps.version and :url. Depending on the platform and browser, check if you have to change other settings too. (Supported operating systems: Sauce Labs OnDemand, TestingBot.)

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://key:secret@hub.testingbot.com:80/wd/hub", 
  :desired_capabilities => caps)

Of course, replace key and secret with your credentials.

I have run pretty much the same script as in the previous post. The script opens the browser, goes to 9 sites and closes the browser. Actually, it does that with and without using net-http-persistent gem, on a local browser, at Sauce Labs OnDemand and at TestingBot.

(I could not figure out how to make the last two columns display rounded numbers.)

What do the numbers say?

net-http-persistent gem this time helped to reduce test run time up to 10%, but other tests showed up to 15% shorter times.

TestingBot is still about 2 times slower than running a local browser, but Sauce Labs OnDemand is about 4 times slower. So, running tests at TestingBot is about 2 times faster than at Sauce Labs OnDemand.

As usual, if you want to run the script yourself, here it is:

Written by Željko Filipin

May 31st, 2012 at 4:19 pm