Test Automation Using Watir and Power of Watir With Ruby Libraries

Description: An article on how watir helps Test7. Running Automated test cases help to achieve
automation and power of Watir by implementing Rubygood test coverage
librariesSetting Up the Environment:
Introduction:The latest versions of Ruby 1.8.2 and Watir 1.6 and
I am using Watir for our product test automation and Iinstall ruby using one-click installer.
want to share some of it's powerful features ofRuby libraries:
Watir. Testing a web based application using differentWatir uses ruby libraries and I am sharing some of the
sets of data can be repeated task (Term calledexisted libraries:a. Network access, ftp, http, SMTP,
Regression testing). In this article we can walk throughPOPb. Test::Unitc. Database connectivityd. win 32 ole
how data driven tests can be performed and how theRuby has access to the WIN32OLE library, which is
test results can be saved.basically like an API for windows applications. What
Picking a Automation Tool:you can do is use this library to catch these pop up
Automation team can choose the good tool for theirwindows. Below is the code that you'll have to add
test automation needs. There are many powerful toolsand need to run in a Ruby script.require 'win32ole' - It
available in market which would be more costly. Butloads the win32ole library in the Watir Test scripts. We
watir comes as Open source frame work to simulateneed to include 'require' statement to the Watir library
all the browser activities.to load the Ruby test libraries.
First of all brief introduction of about WATIR features:Running a Watir test:
1. Watir Stands for "Web Application Testing In Ruby"I am sharing below mentioned Watir examples:
2. Open-source Framework for browser-based1. How to automate the simple login scenario.
automated testing.2. How to work with excel file (how to read the data
3. Test scripts are written in the Ruby programmingfrom Excel file)
language and Watir is a ruby library that simulate user3. How to store the test results in log file.
action in the browsers.4. How to work with outlook (how to send an email to
4. It Supports all major browsers. (IE 6.0 and aboveother persons)
and Firefox 2.0 and above versions)1. How to automate the simple login scenario:require
5. Ideal for smoke and Regression testing (Automated"D:WATIRScriptLoglogger.rb"require "watir"require "test
test cases which are we need execute repeatedly)unit"require "win32ole"class TC_Login
6. Ability to use the full power of Ruby in test scripts'D:WATIRScriptLogfilename',:trunc => false)
.(Ruby is pure oops based languageand it has power$format = PatternFormatter.new( :pattern => "[%l]
to read the data from excel files and to write the data%d :: %m")
to excel files, xml files.)$file.