First Steps with WATIR

Watir is an open-source ruby-based browser automation tool. I first looked at it 6 months ago but with a new loadrunner role to involve myself with, I didn’t get far.

In any case, these are the steps I took to get started and to get things up and running.

  • 1. Install Ruby from ruby-lang.org. I chose version 1.9.2 as the most current stable build (despite a warning stating that Watir didn’t work on 1.9.2… we’ll see about that).
  • 2. Following the instructions here on watir.com, I updated the rubygems and installed Watir. I left the firefox addin as it’s not compatible with the latest version and I was loathe to downgrade my main browser. I have IE and Chrome too so I figured if one of them would run, that would be sufficient.
  • 3. Picked up the watir-webdriver whilst I was at it. Documentation can be found here at the excellent watirMelon site. I just used this command in a dos prompt:

    gem install watir-webdriver

  • 4. I grabbed the chromedriver executable from here and dropped the executable in my ruby/bin/ folder as I know that’s in my path.
  • Continue reading

    First Steps with QTP

    Matt:
    So I’ve got around 10 years experience with Loadrunner, am well-versed with Winrunner, can code in half a dozen languages and still I never got around to learning QTP. Well now I have no choice since we’re using it at my latest client site.
    The aim of this article is to provide guidance in QTP, how to start, what to look at, how to record a simple script and parameterise it. The essentials, basically.

    I recorded a simple script going from Google to AS.org, inserted one checkpoint as I was doing so. It seems that the insertion of checkpoint is best done at record-time. I’m not clear yet on how to insert one afterwards…

    My script looks like:
    Browser("Google").Page("Google").WebEdit("q") _
    .Set "automationsolutions.org"
    Browser("Google").Page("Google").WebEdit("q").Submit
    Browser("Google").Page("automationsolutions.org") _
    .Link("Automation Solutions").Click
    Browser("Google").Page("Automation Solutions").Check _
    CheckPoint("Automation Solutions")

    It’s very readable I suppose and handily is built around Visual Basic, one of the languages I am familiar with.

    Standard stuff like Browser, Page, WebEdit, (“q”, by the way is the name of the textbox object on Google’s homepage. Check with Firebug if you want confirmation) Link and Click are container objects or Actions for specific data, but I don’t think “Google”, “Automation Solutions” or that CheckPoint tell me enough about what’s going on – is “Google” www.google.co.uk?, is “Automation Solutions” a link to the site or a string to be pushed to the browser? And what is that checkpoint checking for?

    The Object Repository

    Right-Clicking on the keyword “Google” brings up a menu with Object Properties uppermost in the list. Clicking on that brings up this:

    !img_placeholder!

    I’m not happy with the default properties and although QTP might feel they’re sufficient to identify the object, I want more information so I click the green +.
    I can see URL is available for selection (as openurl) so I select that. It has no effect on the code, but in the event I need to debug, I can see how knowing the url could be useful.

    !img_placeholder!

    Right-clicking on the checkpoint brings up:

    !img_placeholder!

    It shows what text is being searched for, and it also shows that it can be parameterised. Having added it to the global table, I am forced to wonder how best to data-drive a QTP test.

    Conclusion

    Using google to search for a data string, find a link based on that string and then check that its on the page we expected might seem trivial but it’s allowed us to see the basics of QTP