SlideShare une entreprise Scribd logo
1  sur  29
Introduction to Ruby-Watir
PRESENTED BY: SUBHASISH PATTANAIK
SOFTWARE QUALITY ANALYST
MINDFIRE SOLUTIONS
Contents

What is Watir?

What WATIR is not...

What is Ruby?

How does Watir works?

Why Watir?

Setting up WATIR

Learning WATIR

IDE's for Ruby-Watir

Small Scripts
What is WATIR?

Web Application Testing In Ruby

It is a library for the Ruby language which drives Firefox,
Google Chrome, Internet Explorer the same way people
do;

clicks links,

fills in forms,

and presses buttons.

Watir can also check results, such as whether expected
text appears on the page.

It can be used to test all types of web applications
(ASP.Net, JSP, PHP, Rails, etc…)

Open Source – written by Bret Pettichord, Paul Rogers and
many other contributors.
What WATIR is not...

Watir is not a record/playback tool.

However, there are several recorders “out there”

WatirMaker

Watir WebRecorder

Webmetrics RIA Script Recorder (most recent discussion…they
are considering open sourcing their application)

Watir is not a link checker.

However, you can easily write your own link checker and customize
it to your specific needs.

Watir is not a test case management tool.

However, you can write one in Ruby if desired.

Doesn’t test Flash or Applets.
What is Ruby?

Full featured Object Oriented scripting language

Made “famous” for it’s web application framework Rails. (Ruby on
Rails)

Interpreted rather than compiled

Written by Matz (Yukihiro Matsumoto)

Started in 1994

Written in C

Will work on any platform that has a C compiler

Windows

Linux
How does Watir works?

Uses the COM interface of Internet Explorer (IE)

Allows an external program to control IE

Similar interfaces exist for Word, Excel, PowerPoint and Outlook.

Full access to the contents of an HTML page

Provides different ways to access objects
The Big Question :
Why Watir?
Why Watir? (contd...)

As a testing tool: It’s as robust & sophisticated as
‘professional’ tools such as Rational, Mercury & Segue.

As a library of a programming language [Ruby ] : It’s 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 can think of…)

No “Vendor-script”

It’s simple – elegant – INTUITIVE

It has a supportive online community for when you get ‘stuck’.
Setting up WATIR
Learning WATIR :
Getting Started
As you start to get into Ruby/Watir you’ll want some Good
information at your fingertips!
Introductory Documentation:

Watir homepage: http://watir.com

Watir User Guide: http://en.wikipedia.org/wiki/watir
Books:

Everyday Scripting with Ruby: for Teams, Testers, and You:
http://pragprog.com/book/bmsft/everyday-scripting-with-ruby

Programming Ruby (Online Book): http://ruby-
doc.com/docs/ProgrammingRuby/
Learning WATIR :
More In-Depth
Forums:

Watir General Forum (now on Google Groups):
http://groups.google.com/group/watir-general?hl=en

Watir Search (web interface that searches 7 Watir sites):
https://www.google.com/cse/home?
cx=007267089725385613265:gmydx5gtw6u

Online Ruby Information: http://www.ruby-doc.org/

Watir Book : https://github.com/watir/watirbook
Development
Environment's(IDE's)
for Ruby
Use any text editor as an IDE:

ScITE (Free)

Included with your ruby download.

Notepad ++(Free)

Eclipse (using RDT Plugin)

http://rubyeclipse.sourceforge.net/

Ruby In Steel (Free - $199) (Add-on to VS.Net )

http://www.sapphiresteel.com

Komodo IDE ($295) / Komodo Edit (Free)

http://www.activestate.com
Using Ruby's
Interactive Command
Interpreter (IRB)

What is it?

Interactive Ruby.

It evaluates Ruby expressions from the Terminal.

Used To:

Run quick experiments to see if things will work in your tests
– irb (main) : 001 : 0> require 'watir'.
– irb (main) : 002 : 0> require 'watir-webdriver'.
– irb (main) : 003 : 0> browser = Watir::Browser.new'.
– irb (main) : 004 : 0> browser.goto 'http://google.com'
Let's Get Started..
It’s time to turn on
the Watir!
Anatomy of Watir
Script
# Loads the watir gems
require 'watir'
# Loads all the gems required to drive firefox and chrome
require 'watir-webdriver'
# To open a new browser(firefox)
browser = Watir::Browser.new :firefox
# Navigate to the below URL
browser.goto 'http://ourgoalplan.com/'
# Identify the field to which data is to be inserted and enter the value
browser.text_field(:name => 'txtName').set 'subhasish.pattanaik'
browser.text_field(:name => 'txtPassword').set 'subh_2727'
# To click the button
browser.button( :id => 'btnLogin').click
# To enter the goals in the Text area
browser.text_field( :id => 'ucAddGoal_txtAddGoal').set '[CIRRATA-
WP] : TESTING + ISSUES REPORTING[EST - 2HRS]' + "n" +
'[COMMETTE] : TESTING + ISSUES REPORTING[EST - 2HRS]'
# To click on the Add Goal button
browser.button( :id => 'ucAddGoal_btnAddGoal').click
Use Watir

Using Watir API is very easy.

Reference the Watir API using the keyword 'require' and start
coding.
require 'watir'
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
Web Pages are all
about Objects

Web pages are developed with objects:

Links, buttons, tables, drop-down boxes, forms, frames, etc.

Watir scripts need to access these objects &
manipulate them just as a user would.

Clicking, submitting, typing, selecting, etc…
Manipulating Web Page
Objects:Link
Manipulating Web Page
Objects:Checkbox
Manipulating Web Page
Objects:Radio Buttons
Manipulating Web Page
Objects:Selection Boxes
Manipulating Web Page
Objects:Text Fields
Manipulating Web Page
Objects:Buttons
A Closer Look... at the
structure
browser.button(:value, "Click
Me").click
[Variable] . [method] (: [element] , “ [unique identifier]” . [method]
Test Automation is
MORE than Identifying
Objects

Identifying objects is currently the most time
consuming part of creating your test scripts…

However, after your objects have been identified
& manipulated: you want to “Test” them!

You’ll want to create “PASS” or “FAIL”
scenarios.
…This is the most sophisticated part
of your scripts. Will learn more on this
in next seminar...
Congratulations!
You are on your Way
…to programming the Ruby-Watir way !!
References
1. https://github.com/watir/watirbook
2. http://watir.com/
3. http://watir.com/examples/
4. http://www.thoughtworks.com/insights/articles/automated-
testing-using-ruby-and-watir
5. http://watirwebdriver.com/
6. http://www.rubywatir.com/
7. http://en.wikipedia.org/wiki/Watir
Thank You
Any Queries???
Introduction to Automated Web Testing with Ruby Watir

Contenu connexe

Tendances

Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST APIFabien Vauchelles
 
Introduction To WordPress
Introduction To WordPressIntroduction To WordPress
Introduction To WordPressCraig Bailey
 
Web Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolWeb Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolSperasoft
 
What-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxWhat-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxAbhijeetKumar456867
 
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...Edureka!
 
Basic Wordpress PPT
Basic Wordpress PPT Basic Wordpress PPT
Basic Wordpress PPT mayur akabari
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask PresentationParag Mujumdar
 
SRS For Online Store
SRS For Online StoreSRS For Online Store
SRS For Online StoreAhsan Rizwan
 
Web application presentation
Web application presentationWeb application presentation
Web application presentationEhsan Ullah Kakar
 
WordPress for Education PPT
WordPress for Education PPTWordPress for Education PPT
WordPress for Education PPTjekkilekki
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...Edureka!
 
Online Shopping based on ASP .NET
Online Shopping based on ASP .NET Online Shopping based on ASP .NET
Online Shopping based on ASP .NET Pragnya Dash
 
Detox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationDetox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationViktorija Sujetaitė
 

Tendances (20)

Dynamic Web
Dynamic WebDynamic Web
Dynamic Web
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
Introduction To WordPress
Introduction To WordPressIntroduction To WordPress
Introduction To WordPress
 
Web Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolWeb Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI Tool
 
What-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxWhat-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptx
 
Onlineshopping
OnlineshoppingOnlineshopping
Onlineshopping
 
Project Reactor By Example
Project Reactor By ExampleProject Reactor By Example
Project Reactor By Example
 
Laravel Lab
Laravel LabLaravel Lab
Laravel Lab
 
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
 
Basic Wordpress PPT
Basic Wordpress PPT Basic Wordpress PPT
Basic Wordpress PPT
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
 
Java 8 date & time api
Java 8 date & time apiJava 8 date & time api
Java 8 date & time api
 
SRS For Online Store
SRS For Online StoreSRS For Online Store
SRS For Online Store
 
Web application presentation
Web application presentationWeb application presentation
Web application presentation
 
Sonar Review
Sonar ReviewSonar Review
Sonar Review
 
WordPress for Education PPT
WordPress for Education PPTWordPress for Education PPT
WordPress for Education PPT
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
 
Online Shopping based on ASP .NET
Online Shopping based on ASP .NET Online Shopping based on ASP .NET
Online Shopping based on ASP .NET
 
Online shopping
Online shoppingOnline shopping
Online shopping
 
Detox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationDetox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automation
 

En vedette

Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with RubyKeith Pitty
 
What you can do In WatiR
What you can do In WatiRWhat you can do In WatiR
What you can do In WatiRWesley Chen
 
watir-webdriver
watir-webdriverwatir-webdriver
watir-webdriverjariba
 
Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. ASumanth krishna
 
FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRCharlie Gracie
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Keyword Driven Framework using WATIR
Keyword Driven Framework using WATIRKeyword Driven Framework using WATIR
Keyword Driven Framework using WATIRNivetha Padmanaban
 
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
프로그래머로 부터  배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)프로그래머로 부터  배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)Mayuko Sekiya
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and RubyYnon Perek
 

En vedette (9)

Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
 
What you can do In WatiR
What you can do In WatiRWhat you can do In WatiR
What you can do In WatiR
 
watir-webdriver
watir-webdriverwatir-webdriver
watir-webdriver
 
Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. A
 
FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMR
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Keyword Driven Framework using WATIR
Keyword Driven Framework using WATIRKeyword Driven Framework using WATIR
Keyword Driven Framework using WATIR
 
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
프로그래머로 부터  배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)프로그래머로 부터  배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 

Similaire à Introduction to Automated Web Testing with Ruby Watir

Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...Sla Va
 
Page object from the ground up.ppt
Page object from the ground up.pptPage object from the ground up.ppt
Page object from the ground up.pptJoseph Beale
 
Page object from the ground up by Joe Beale
Page object from the ground up by Joe BealePage object from the ground up by Joe Beale
Page object from the ground up by Joe BealeQA or the Highway
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.jsAyush Mishra
 
WebMatrix, see what the matrix can do for you!!
WebMatrix, see what the matrix can do for you!!WebMatrix, see what the matrix can do for you!!
WebMatrix, see what the matrix can do for you!!Frédéric Harper
 
.NET Recommended Resources
.NET Recommended Resources.NET Recommended Resources
.NET Recommended ResourcesGreg Sohl
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecuritiesamiable_indian
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby Sla Va
 
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!Frédéric Harper
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Anna Klepacka
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Tom Johnson
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting languageAbhayDhupar
 
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...itsatony
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS UniverseStefano Di Paola
 
Cross Browser Automation Testing Using Watir
Cross Browser Automation Testing Using WatirCross Browser Automation Testing Using Watir
Cross Browser Automation Testing Using WatirSarah Elson
 
Microsoft WebMatrix Platform Overview
Microsoft WebMatrix Platform OverviewMicrosoft WebMatrix Platform Overview
Microsoft WebMatrix Platform OverviewSpiffy
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsRyan Weaver
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development PresentationTurnToTech
 
WebFest 2011 WebMatrix Overview by Gavin Warrener
WebFest 2011 WebMatrix Overview by Gavin WarrenerWebFest 2011 WebMatrix Overview by Gavin Warrener
WebFest 2011 WebMatrix Overview by Gavin WarrenerSpiffy
 

Similaire à Introduction to Automated Web Testing with Ruby Watir (20)

Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
 
Page object from the ground up.ppt
Page object from the ground up.pptPage object from the ground up.ppt
Page object from the ground up.ppt
 
Page object from the ground up by Joe Beale
Page object from the ground up by Joe BealePage object from the ground up by Joe Beale
Page object from the ground up by Joe Beale
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.js
 
WebMatrix, see what the matrix can do for you!!
WebMatrix, see what the matrix can do for you!!WebMatrix, see what the matrix can do for you!!
WebMatrix, see what the matrix can do for you!!
 
.NET Recommended Resources
.NET Recommended Resources.NET Recommended Resources
.NET Recommended Resources
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby
 
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
 
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Cross Browser Automation Testing Using Watir
Cross Browser Automation Testing Using WatirCross Browser Automation Testing Using Watir
Cross Browser Automation Testing Using Watir
 
Microsoft WebMatrix Platform Overview
Microsoft WebMatrix Platform OverviewMicrosoft WebMatrix Platform Overview
Microsoft WebMatrix Platform Overview
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
 
WebFest 2011 WebMatrix Overview by Gavin Warrener
WebFest 2011 WebMatrix Overview by Gavin WarrenerWebFest 2011 WebMatrix Overview by Gavin Warrener
WebFest 2011 WebMatrix Overview by Gavin Warrener
 
Scout web
Scout webScout web
Scout web
 

Plus de Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Dernier

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 

Dernier (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Introduction to Automated Web Testing with Ruby Watir

  • 1. Introduction to Ruby-Watir PRESENTED BY: SUBHASISH PATTANAIK SOFTWARE QUALITY ANALYST MINDFIRE SOLUTIONS
  • 2. Contents  What is Watir?  What WATIR is not...  What is Ruby?  How does Watir works?  Why Watir?  Setting up WATIR  Learning WATIR  IDE's for Ruby-Watir  Small Scripts
  • 3. What is WATIR?  Web Application Testing In Ruby  It is a library for the Ruby language which drives Firefox, Google Chrome, Internet Explorer the same way people do;  clicks links,  fills in forms,  and presses buttons.  Watir can also check results, such as whether expected text appears on the page.  It can be used to test all types of web applications (ASP.Net, JSP, PHP, Rails, etc…)  Open Source – written by Bret Pettichord, Paul Rogers and many other contributors.
  • 4. What WATIR is not...  Watir is not a record/playback tool.  However, there are several recorders “out there”  WatirMaker  Watir WebRecorder  Webmetrics RIA Script Recorder (most recent discussion…they are considering open sourcing their application)  Watir is not a link checker.  However, you can easily write your own link checker and customize it to your specific needs.  Watir is not a test case management tool.  However, you can write one in Ruby if desired.  Doesn’t test Flash or Applets.
  • 5. What is Ruby?  Full featured Object Oriented scripting language  Made “famous” for it’s web application framework Rails. (Ruby on Rails)  Interpreted rather than compiled  Written by Matz (Yukihiro Matsumoto)  Started in 1994  Written in C  Will work on any platform that has a C compiler  Windows  Linux
  • 6. How does Watir works?  Uses the COM interface of Internet Explorer (IE)  Allows an external program to control IE  Similar interfaces exist for Word, Excel, PowerPoint and Outlook.  Full access to the contents of an HTML page  Provides different ways to access objects
  • 7. The Big Question : Why Watir?
  • 8. Why Watir? (contd...)  As a testing tool: It’s as robust & sophisticated as ‘professional’ tools such as Rational, Mercury & Segue.  As a library of a programming language [Ruby ] : It’s 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 can think of…)  No “Vendor-script”  It’s simple – elegant – INTUITIVE  It has a supportive online community for when you get ‘stuck’.
  • 10. Learning WATIR : Getting Started As you start to get into Ruby/Watir you’ll want some Good information at your fingertips! Introductory Documentation:  Watir homepage: http://watir.com  Watir User Guide: http://en.wikipedia.org/wiki/watir Books:  Everyday Scripting with Ruby: for Teams, Testers, and You: http://pragprog.com/book/bmsft/everyday-scripting-with-ruby  Programming Ruby (Online Book): http://ruby- doc.com/docs/ProgrammingRuby/
  • 11. Learning WATIR : More In-Depth Forums:  Watir General Forum (now on Google Groups): http://groups.google.com/group/watir-general?hl=en  Watir Search (web interface that searches 7 Watir sites): https://www.google.com/cse/home? cx=007267089725385613265:gmydx5gtw6u  Online Ruby Information: http://www.ruby-doc.org/  Watir Book : https://github.com/watir/watirbook
  • 12. Development Environment's(IDE's) for Ruby Use any text editor as an IDE:  ScITE (Free)  Included with your ruby download.  Notepad ++(Free)  Eclipse (using RDT Plugin)  http://rubyeclipse.sourceforge.net/  Ruby In Steel (Free - $199) (Add-on to VS.Net )  http://www.sapphiresteel.com  Komodo IDE ($295) / Komodo Edit (Free)  http://www.activestate.com
  • 13. Using Ruby's Interactive Command Interpreter (IRB)  What is it?  Interactive Ruby.  It evaluates Ruby expressions from the Terminal.  Used To:  Run quick experiments to see if things will work in your tests – irb (main) : 001 : 0> require 'watir'. – irb (main) : 002 : 0> require 'watir-webdriver'. – irb (main) : 003 : 0> browser = Watir::Browser.new'. – irb (main) : 004 : 0> browser.goto 'http://google.com'
  • 14. Let's Get Started.. It’s time to turn on the Watir!
  • 15. Anatomy of Watir Script # Loads the watir gems require 'watir' # Loads all the gems required to drive firefox and chrome require 'watir-webdriver' # To open a new browser(firefox) browser = Watir::Browser.new :firefox # Navigate to the below URL browser.goto 'http://ourgoalplan.com/' # Identify the field to which data is to be inserted and enter the value browser.text_field(:name => 'txtName').set 'subhasish.pattanaik' browser.text_field(:name => 'txtPassword').set 'subh_2727' # To click the button browser.button( :id => 'btnLogin').click # To enter the goals in the Text area browser.text_field( :id => 'ucAddGoal_txtAddGoal').set '[CIRRATA- WP] : TESTING + ISSUES REPORTING[EST - 2HRS]' + "n" + '[COMMETTE] : TESTING + ISSUES REPORTING[EST - 2HRS]' # To click on the Add Goal button browser.button( :id => 'ucAddGoal_btnAddGoal').click
  • 16. Use Watir  Using Watir API is very easy.  Reference the Watir API using the keyword 'require' and start coding. require 'watir' require 'watir-webdriver' browser = Watir::Browser.new :firefox
  • 17. Web Pages are all about Objects  Web pages are developed with objects:  Links, buttons, tables, drop-down boxes, forms, frames, etc.  Watir scripts need to access these objects & manipulate them just as a user would.  Clicking, submitting, typing, selecting, etc…
  • 24. A Closer Look... at the structure browser.button(:value, "Click Me").click [Variable] . [method] (: [element] , “ [unique identifier]” . [method]
  • 25. Test Automation is MORE than Identifying Objects  Identifying objects is currently the most time consuming part of creating your test scripts…  However, after your objects have been identified & manipulated: you want to “Test” them!  You’ll want to create “PASS” or “FAIL” scenarios. …This is the most sophisticated part of your scripts. Will learn more on this in next seminar...
  • 26. Congratulations! You are on your Way …to programming the Ruby-Watir way !!
  • 27. References 1. https://github.com/watir/watirbook 2. http://watir.com/ 3. http://watir.com/examples/ 4. http://www.thoughtworks.com/insights/articles/automated- testing-using-ruby-and-watir 5. http://watirwebdriver.com/ 6. http://www.rubywatir.com/ 7. http://en.wikipedia.org/wiki/Watir