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-
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
# Open one new IE browser
# Define one variable
# 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.