My Space

June 20, 2006

Watir

Filed under: Testing Tools — Mayank @ 2:17 pm

Last two days I spent my time on Watir (Pronounced “Water”) testing tool. It’s open source functional testing tool, means totally free to use and you can download this testing tool from here- Watir But like other testing tools it has some dependencies like it uses Ruby scripting language, IE browser and runs only on Windows. So to use Watir you must install Ruby on your system. It does not support other browsers like Firefox, Mozilla, and others. Watir is totally different from other testing tools like WinRunner, QTP and others because it does not support Recording and Playback concept. Now one question is ommited over here that how we can test our web application? So answer is that we can write test script in Notepad in Ruby scripting language and save with .rb extension and run this file through command prompt.

If you want to install Ruby or Watir testing tool then go to this link-

http://wtr.rubyforge.org/

Today I have written one basic script for Watir, which is given below. If you trying to understand that where we can start then follow this script.

# the watir controller

require ‘watir’

# Open one new IE browser

browser=Watir::IE.new

# Define one variable

test_site=”http://www.openapp.org

# Put the website address in Address Bar browser.goto(test_site)

So this is very small script for opening openapp.org site. If you want to run with Watir then it’s very necessary that you should learn some basics of Ruby.

Here I’m describing how this script works behind the window.

require ‘Watir’ If you want to use Watir testing tool then first type this syntax at the beginning of the script. This syntax allows our test script to use Watir testing tool.

test_site=”http://www.yahoo.com abc is simple variable which is having one URL. In Ruby every variable start with small latter.

browser=Watir::IE.new browser is also simple variable. This syntax tells Watir tool that open one new IE browser.

.new is Method (Please go through Ruby).

browser.goto(test_site) this syntax will tell Watir that put the abc contain URL on the address bar.

.goto is also Method.

So this is description about one small Watir script. I’ll come with further discussions and welcome your questions and suggestions.

5 Comments »

  1. hi bhaiya,
    Thanks for it. i don’t have any knowledge about testing tools before that but now after reading this blog i have understood that what realy it does.
    give me some more information about that.
    waiting for your reply.
    thanks
    romen

    Comment by Romen Banarjee — June 21, 2006 @ 4:30 am | Reply

  2. Hi Romen,

    Thanks for your reply.

    I’ll come with further discussion about testing tools very soon.

    Comment by Mayank — June 21, 2006 @ 9:57 am | Reply

  3. As you mentioned “It does not support for FirFox, Mozilla and other” but I checked Its supported for those browsers…
    Please let me know support for other lanuages…
    but I like your synatx

    Comment by Dattatray Patil — June 4, 2008 @ 9:39 am | Reply

  4. Hi

    my self vinay. I’m working on “watir” tool for testing web application. I’m finding it difficult to handle popups i tired all the things i could get in google search but i didnt get any solution so kindly request you to suggest me some solution on how to write scripts for handling various kinds of popups.

    thankingyou

    Comment by vinay Lm — April 8, 2009 @ 8:33 am | Reply

  5. Hi all,

    I am learning RUBY for the past 15 days, i want to test a web application using a watir.I have installed ruby ,then i Installed Watirrecorder++ for recording the website.when i click on play backoption after recording I am not able to capture all the mouse movement could u please help me.

    Thank & Regards,
    Muthukumaran.T

    Comment by Muthukumaran.T — November 10, 2009 @ 7:29 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.