Seminar on Introduction To Ruby-Watir

Back to Seminar


Topic Name:
Introduction To Ruby-Watir

Subhasish Pattanaik

Short Description:
This seminar involves the presentation of fundamentals/basics of Ruby-WATIR(Web Application Testing In Ruby) for the tester to automate there testing methods and steps.

Business Transcription:

Hello all, I am Subhasish over here, today we are here for the seminar, introduction to Ruby-watir. Lets get into content first  like what is watir, what watir is not, what is ruby, how does watir works, why watir, setting up watir, learning watir, ideas for ruby watir.


So what is watir? Watir is web application testing in ruby it is very simple and dynamic and it is the library for the ruby language which drives Firefox, google Chrome, Internet Explorer, Safari and Opera, the same way people do like click links, fills in forms, and presses buttons, watir also check results, such as whether expected text appears on the page. It can be used to test all kind of web applications (, JSP, PHP, Rails, etc...) more over it is open source : Written by Bret Petichord, Paul Rogers and many others contributions.


What watir is not? There are several recorders there like watir maker,watier web recorder, webmetrics RIA  script recorder it is more recent discussion they are considering open sourcing their application like these are the third party APIs  which can be configured with watir to make a recorder or playback.

Now watir is not a link cheker, however you can write your own link cheker and customize it to your specific needs.

Watir is not a test case management tool but however you can write one in ruby if desired. Last but not the least, it does not test flash or applets. What is ruby? Its very famous for their framework and it is fully featured object oriented scripting language, made famous for its web application framework rails, interpreted rather than compiled, then written by Matz started in 1994, written in C will work in any platform that has a C compiler, windows, linux.


How Watir works? Uses the COM interface of internet explorer, allows an external program to control IE, allows an external program to control IE similar interface exist for word, excel, powerpoint and outlook, full access to the contents of an HTML page, provides different ways to access objects. Watir is very easy to write a script, it is a robust programing language and not another tool.basically like when you are learning watir its not only you are learning web application testing in ruby its also ruby robust programing language.


What is watir?

As a testing tool its as robust and sophisticated as professional  tools such as rational, mercury and segue, as a library of a programing language (ruby) its a powerful, you have the power to connect to databases, read data files, export XML, structure your code into reusable libraries and pretty much anything else you think of, no vendor script, you dont have any third party vendor script, we need to write our own self script  and it will be executed.


It is simple, elegant and intuitive, it means suppose I am writing a script and I will pass it to you and without thinking and without changing you can run the script and you will have your derived result like we have few example  by default with ruby that comedown with watir.


And it has a very big supportive  online community for when you  get stuck,they have online forum, online community and groups in ruby so that can help you out to get stuck. We need not need any Windows or specific linux you can run it on any website or linux so we are able to run it. Suppose Safari is there, Mac is there or Firefox is there then you need to download some APIs, suppose we download watir web driver then it is third party APIs connect with watir.


Now setting of watir firstly you need  to chek your system like ruby is available in your system or not to do that you can open your command line promt and check with it like this (look into the slide) if it is shown ruby1.9.3 then it is installed in your system if it is not installed it will show an invalid command. If ruby is installed you need to see whether all the gems are installed or not. Like all the gems are the packages that will be needed in ruby to run watir.ruby, watir itself is a gem it’s a package so we need to check, so its showing that the rubys package is 2.3.0, it is one we need to update  keep in gems package.


Now thing is that this is the most stable version of ruby because all the gems are not updated to 2.1 or 2.0. so 1.9.3 package actually we have all the gems updated for ruby so it is the most stable version for this time being and for begineer this is the most suggested one. So as we have ruby and gems installed in our system so next thing is that we are installed APIs to run our chrome, to run our Firefox and by internet explorer it is by default present.


For learning watir we  can browse through watir, by site and Wikipedia is there and for book related we have watir book with ruby itself and when we installed ruby it comes with ruby itself and everyday scripting with ruby for team testers and you it is not free you need to download it by paying. We have forum that online support community like ruby doc general forum like ruby developer and ruby users, programmers there they can help you with any problems.


We have different IDEs like ScITE that is free with ruby download, note pad++, eclipse using RDT plugin, ruby  is still that is third party IDEs this is paid one, then komodo IDE.


What is IRB?

It is interactive ruby it evaluates ruby expression from terminal, it used to run quick experiments to see if things will work on your tests. You just need to open command Chrome and type IRB after you install ruby it goes to interactive command interpreted of ruby so you can test whether your script will work or not with that particular command like you enter the single command it will show you whether your script and command is ok or not. I will write require watir it says true that means it ok, suppose I write require and I omit columns and write watir it says the error undefined local variable methods for watir  so this is the way we can check each and single command  and this is why we use IRB.


Now it is the interactive ruby it evaluates ruby expression for terminals. It used to run quick experiments. We used basic three commands like reqire watir which loads all the gems of watir, then require web driver it loads webdriver package of watir then browser is equal to watir: we can by default write or we can direct it to a particular browser like firefox.Then browser gotohttp this three thing will done here one by one can also compile it in a single script (look into slide).

Anatomy of watir script.


Require watir loads the watir gems, requires watir web driver it loads all the gems required to drive firefox and chrome then browser is equal to watir::browser. new:firefox it opens a new browser then navigate to below URL its for our goalplan then browser.text_field it identifies the field to which data is to be inserted  nad enter the value. Then browser.button to click the button.(look into slide)


Tags: Ruby, Ruby-Watir, AutomationTesting, Testing-Tool, Testing, Seminar

Featured Seminar

News & Updates

  • November 19

    20th Year Anniversary Celebration at Malaysia

  • March 19

    Ninth Edition: DDMIT Quiz

Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome  DB Stpi

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2018. Login