SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Demystifying Keyword Driven Using WATIR


Inspiration:
While working for growing organization where QA budget is limited and cannot afford to
spend thousand of dollars on commercial tool like WinRunner/QTP, a need was felt
within QA team to use automated functional tool.

WATIR (Web Application Testing In Ruby) was selected as freeware tool for POC.
WATIR can be downloaded from http://wtr.rubyforge.org/install.html

Baby Steps:
 After downloading WATIR, QA team started reading through the documentation and
quickly realized that it is extremely user friendly and does not take much time to write
first functional automated test.
Soon we started creating automation test cases and as the count of test cases grew, the
maintainability of WATIR code started to become a big problem. A need for framework
was felt and since everyone in QA world talks about Keyword Driven framework, we
decided to implement the same.

Roadblock:
QA team Google and found thousands of document related to Keyword Framework on
internet. All of the documents talk about “WHAT” instead of “HOW” to create Keyword
Framework.
QA Team took this up as challenge and decided to build Keyword Framework with
minimum strings attached.

The following pages talk about “HOW” to implement Keyword Framework. We hope,
this document will help demystify the Keyword Framework and knowledge will be
accessible to everyone instead of fortunate few.
Step 1:
Identify and understand the fields available on Excel sheet

Excel sheet is use to separate the code logic and data. Test data and the
operations/sequence of the test is planned in external data file.

               Object
                Prop         Object Prop        Expected    Actual
 Keyword       Name            Value             Output     Output   Parm_01   Screenshot_Name
Column Name Explanation
   • Keyword : They are special words which would be use to drive the code
   • Object Prop Name : Each object on webpage can be identified by Property Name
   • Object Prop Value : Each object on page layout can be identified by Property
      Vlaue
   • Expected Output : This column contain the expected result
   • Actual Output : The text step pass or fail
   • Parm_01: Parameter use to enter/select data on webpage
   • Screenshot_Name : Use to store the screenshot name of Actual result

Step 2:
Following are the high level test steps which would be automated using WATIR
    • Open Browser and navigate to Google
    • Enter “Astadia” in search text box
    • Click on website for Astadia
    • Verify text Astadia on website

Step 3:
Identify the Keywords to be use. Keywords chosen should be self explanatory as this will
help to transition the work of creating testcases to manual testers allowing automation
expert to concentrate on writing code.

Following Keywords were identified
  Keyword                               Explaination
OpenURL        Use to open IE browser and navigate to specific URL
SetText        Use to write text to textbox
ClickButton    Use to click on button
ClickLink      Use to click on link
Result         Use to compare expected and actual result.




Step 4 :
Write Pseudo Code and then we will convert it into WATIR

Open Excel File
       Loop through each sheet
              For each row in sheet
                     Use CASE statement and perform actions depending on Keyword
                     End Case
              End For
       End Loop
Close Excel File

Step 5:
Created Excel File as follows

                                                            Actu
              Objec                                          al
              t Prop                             Expecte    Out
 Keyword      Name       Object Prop Value       d Output   put           Parm_01             Screenshot_Name



 OpenURL                                                           http://www.google.co.in/
  SetText     name               q                                         Astadia
 ClickButto
      n       value        Google Search
 ClickLink     href    http://www.astadia.com/
  Result                                         Astadia


To get an object property and value, use Firebug (Add on for Firefox) or IE Developer
Tool bar.




Step 6:
Write code in WATIR and save the file with extension rb

#Include The Library
require 'win32ole'
require 'watir'
require 'watir/IE'
require 'D:AKFWorkingCodeUtility.rb'
require 'watir/screen_capture'
include Watir
include Watir::ScreenCapture

begin

#Open Excel File
excel = WIN32OLE::new('excel.Application')
excel.DisplayAlerts = false
workbook = excel.Workbooks.Open('D:AKFWorkingCodePOC.xls')
#Loop through the worksheets
for i in 1 .. workbook.Worksheets.Count

 worksheet = workbook.Worksheets(i)
 rowcount = worksheet.UsedRange.Rows.Count

 for j in 2..rowcount
  Keyword =worksheet.Cells(j, 1).value
  Object_Prop_Name = worksheet.Cells(j, 2).value
  Object_Prop_Value = worksheet.Cells(j, 3).value
  Expected_Output = worksheet.Cells(j, 4).value
  Parm_01 = worksheet.Cells(j, 6).value

  case Keyword
   when /^OpenURL/
   @Browser=IE.start(Parm_01)
   @Browser.maximize

   when /^SetText/
   @Browser.text_field(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).set(Parm_01)

   when/^ClickButton/
   @Browser.button(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).click

  when/^ClickLink/
  @Browser.link(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).click

  when/^CloseURL/
  @Browser.close
when/^Result/
  Actual_Output=verify_text(Expected_Output,quot;Passquot;,quot;Failquot;)
  worksheet.Cells(j, 5)['Value']=Actual_Output
  time_stamp_s = Time.new.strftime('%m%d_%H%M_%S')
  screenshot_filename=quot;#{time_stamp_s}_#{Expected_Output}quot;+quot;.jpgquot;
  screen_capture(screenshot_filename,active_window_only=false, save_as_bmp=false)
  worksheet.Cells(j, 7)['Value']=screenshot_filename
  workbook.SaveAs('D:AKFWorkingCodePOC.xls')
  else
    quot;Exitquot;
  end

 end

end
 workbook.Close()
excel.quit()

 rescue
 workbook.Close()
 excel.quit()
end

Step 7:
Following will be output of excel after executing above script.

              Objec                                     Actua
                t                             Expecte     l
              Prop                               d      Outpu
 Keyword      Name    Object Prop Value       Output      t            Parm_01            Screenshot_Name
                                                                http://www.google.co.
 OpenURL                                                                  in/
  SetText     name             q                                      Astadia
 ClickButto
      n       value       Google Search
                      http://www.astadia.co
 ClickLink    href             m/


                                                                                        0521_1613_55_Astadia.j
  Result                                      Astadia   Pass                                     pg




Author Biography:
Hirday is currently working as Sr. Manager (QA & CS) in Astadia. He has more than 9
years of IT experience. He is responsible for competency development of the Testing
Group in Astadia.
Hirday is M.S.(Computer Science) from Widener University, USA.
He has worked on development and implementation of software test planning and
framework for test automation on .NET platform.
He can be reached at hlamba@astadia.com

Weitere ähnliche Inhalte

Was ist angesagt?

Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and TricksRoy Ganor
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdfFlutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdfKaty Slemon
 
Create Your Own Framework by Fabien Potencier
Create Your Own Framework by Fabien PotencierCreate Your Own Framework by Fabien Potencier
Create Your Own Framework by Fabien PotencierHimel Nag Rana
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing frameworkIndicThreads
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...Appear
 
Androidreadme
AndroidreadmeAndroidreadme
Androidreadmeiderdik
 
Open Power Template 2 presentation
Open Power Template 2 presentationOpen Power Template 2 presentation
Open Power Template 2 presentationTomasz Jędrzejewski
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratchMohd Manzoor Ahmed
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax componentsIgnacio Coloma
 
Building Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience ManagerBuilding Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience ManagerJustin Edelson
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React AlicanteIgnacio Martín
 
Part 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinterPart 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinterMohamed Essam
 
[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Search[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Searchindeedeng
 
Polymer 2.0 codelab for extreme beginners
Polymer 2.0 codelab for extreme beginnersPolymer 2.0 codelab for extreme beginners
Polymer 2.0 codelab for extreme beginnersSylia Baraka
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Restshravan kumar chelika
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedMarvin Heng
 
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and moreBeyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and moreAri Lerner
 

Was ist angesagt? (20)

Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and Tricks
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdfFlutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
 
Create Your Own Framework by Fabien Potencier
Create Your Own Framework by Fabien PotencierCreate Your Own Framework by Fabien Potencier
Create Your Own Framework by Fabien Potencier
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...
 
Androidreadme
AndroidreadmeAndroidreadme
Androidreadme
 
Open Power Template 2 presentation
Open Power Template 2 presentationOpen Power Template 2 presentation
Open Power Template 2 presentation
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratch
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Building Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience ManagerBuilding Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience Manager
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React Alicante
 
TDD, BDD, RSpec
TDD, BDD, RSpecTDD, BDD, RSpec
TDD, BDD, RSpec
 
Part 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinterPart 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinter
 
[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Search[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Search
 
Polymer 2.0 codelab for extreme beginners
Polymer 2.0 codelab for extreme beginnersPolymer 2.0 codelab for extreme beginners
Polymer 2.0 codelab for extreme beginners
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You Typed
 
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and moreBeyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and more
 

Andere mochten auch

Technology Terms
Technology TermsTechnology Terms
Technology Termsblueblue1
 
Pabellon Sevilla Grimshaw
Pabellon Sevilla  GrimshawPabellon Sevilla  Grimshaw
Pabellon Sevilla GrimshawMenendezCobelo
 
Performing with people how to get your scorecard to deliver its people audi...
Performing with people how to get your scorecard to deliver its people   audi...Performing with people how to get your scorecard to deliver its people   audi...
Performing with people how to get your scorecard to deliver its people audi...Avinash Deshpande
 
Tsd Marketing May 16 12 Final Version Jfa
Tsd Marketing  May 16 12 Final Version JfaTsd Marketing  May 16 12 Final Version Jfa
Tsd Marketing May 16 12 Final Version JfaJoelfAndrews
 
Social Media Landscape
Social Media LandscapeSocial Media Landscape
Social Media LandscapeSue Sutcliffe
 
Las profesiones
Las profesionesLas profesiones
Las profesionesgaribe
 
Witches Part1 power point
Witches Part1 power pointWitches Part1 power point
Witches Part1 power pointmirentelletxea
 
Infrastructure as Code Maturity Model v1
Infrastructure as Code Maturity Model v1Infrastructure as Code Maturity Model v1
Infrastructure as Code Maturity Model v1Gary Stafford
 

Andere mochten auch (15)

Aparato Reproductor Masculino y Femenino
Aparato Reproductor Masculino y FemeninoAparato Reproductor Masculino y Femenino
Aparato Reproductor Masculino y Femenino
 
Linked In 101
Linked In 101Linked In 101
Linked In 101
 
Technology Terms
Technology TermsTechnology Terms
Technology Terms
 
Pabellon Sevilla Grimshaw
Pabellon Sevilla  GrimshawPabellon Sevilla  Grimshaw
Pabellon Sevilla Grimshaw
 
Performing with people how to get your scorecard to deliver its people audi...
Performing with people how to get your scorecard to deliver its people   audi...Performing with people how to get your scorecard to deliver its people   audi...
Performing with people how to get your scorecard to deliver its people audi...
 
Tsd Marketing May 16 12 Final Version Jfa
Tsd Marketing  May 16 12 Final Version JfaTsd Marketing  May 16 12 Final Version Jfa
Tsd Marketing May 16 12 Final Version Jfa
 
Qatar Transport forum 2015
Qatar Transport forum 2015Qatar Transport forum 2015
Qatar Transport forum 2015
 
SistemaNerviosoMariaCaceres
SistemaNerviosoMariaCaceresSistemaNerviosoMariaCaceres
SistemaNerviosoMariaCaceres
 
Genoma Humano
Genoma HumanoGenoma Humano
Genoma Humano
 
Sistema nervioso macm
Sistema nervioso macmSistema nervioso macm
Sistema nervioso macm
 
Social Media Landscape
Social Media LandscapeSocial Media Landscape
Social Media Landscape
 
Las profesiones
Las profesionesLas profesiones
Las profesiones
 
Seminar It
Seminar ItSeminar It
Seminar It
 
Witches Part1 power point
Witches Part1 power pointWitches Part1 power point
Witches Part1 power point
 
Infrastructure as Code Maturity Model v1
Infrastructure as Code Maturity Model v1Infrastructure as Code Maturity Model v1
Infrastructure as Code Maturity Model v1
 

Ähnlich wie Demystifying Keyword Driven Using Watir

CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklum Ukraine
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsRapidValue
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentAccenture Hungary
 
Android ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAndroid ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAravindharamanan S
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Abhijeet Vaikar
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2Simon Su
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog SampleSkills Matter
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code維佋 唐
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium Zoe Gilbert
 
Test Infected Presentation
Test Infected PresentationTest Infected Presentation
Test Infected Presentationwillmation
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJSPeter Drinnan
 

Ähnlich wie Demystifying Keyword Driven Using Watir (20)

CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Gems Of Selenium
Gems Of SeleniumGems Of Selenium
Gems Of Selenium
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
 
Android ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAndroid ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codes
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
 
Test automation
Test  automationTest  automation
Test automation
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Test Infected Presentation
Test Infected PresentationTest Infected Presentation
Test Infected Presentation
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 

Kürzlich hochgeladen

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Kürzlich hochgeladen (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

Demystifying Keyword Driven Using Watir

  • 1. Demystifying Keyword Driven Using WATIR Inspiration: While working for growing organization where QA budget is limited and cannot afford to spend thousand of dollars on commercial tool like WinRunner/QTP, a need was felt within QA team to use automated functional tool. WATIR (Web Application Testing In Ruby) was selected as freeware tool for POC. WATIR can be downloaded from http://wtr.rubyforge.org/install.html Baby Steps: After downloading WATIR, QA team started reading through the documentation and quickly realized that it is extremely user friendly and does not take much time to write first functional automated test. Soon we started creating automation test cases and as the count of test cases grew, the maintainability of WATIR code started to become a big problem. A need for framework was felt and since everyone in QA world talks about Keyword Driven framework, we decided to implement the same. Roadblock: QA team Google and found thousands of document related to Keyword Framework on internet. All of the documents talk about “WHAT” instead of “HOW” to create Keyword Framework. QA Team took this up as challenge and decided to build Keyword Framework with minimum strings attached. The following pages talk about “HOW” to implement Keyword Framework. We hope, this document will help demystify the Keyword Framework and knowledge will be accessible to everyone instead of fortunate few.
  • 2. Step 1: Identify and understand the fields available on Excel sheet Excel sheet is use to separate the code logic and data. Test data and the operations/sequence of the test is planned in external data file. Object Prop Object Prop Expected Actual Keyword Name Value Output Output Parm_01 Screenshot_Name Column Name Explanation • Keyword : They are special words which would be use to drive the code • Object Prop Name : Each object on webpage can be identified by Property Name • Object Prop Value : Each object on page layout can be identified by Property Vlaue • Expected Output : This column contain the expected result • Actual Output : The text step pass or fail • Parm_01: Parameter use to enter/select data on webpage • Screenshot_Name : Use to store the screenshot name of Actual result Step 2: Following are the high level test steps which would be automated using WATIR • Open Browser and navigate to Google • Enter “Astadia” in search text box • Click on website for Astadia • Verify text Astadia on website Step 3: Identify the Keywords to be use. Keywords chosen should be self explanatory as this will help to transition the work of creating testcases to manual testers allowing automation expert to concentrate on writing code. Following Keywords were identified Keyword Explaination OpenURL Use to open IE browser and navigate to specific URL SetText Use to write text to textbox ClickButton Use to click on button ClickLink Use to click on link Result Use to compare expected and actual result. Step 4 :
  • 3. Write Pseudo Code and then we will convert it into WATIR Open Excel File Loop through each sheet For each row in sheet Use CASE statement and perform actions depending on Keyword End Case End For End Loop Close Excel File Step 5: Created Excel File as follows Actu Objec al t Prop Expecte Out Keyword Name Object Prop Value d Output put Parm_01 Screenshot_Name OpenURL http://www.google.co.in/ SetText name q Astadia ClickButto n value Google Search ClickLink href http://www.astadia.com/ Result Astadia To get an object property and value, use Firebug (Add on for Firefox) or IE Developer Tool bar. Step 6:
  • 4. Write code in WATIR and save the file with extension rb #Include The Library require 'win32ole' require 'watir' require 'watir/IE' require 'D:AKFWorkingCodeUtility.rb' require 'watir/screen_capture' include Watir include Watir::ScreenCapture begin #Open Excel File excel = WIN32OLE::new('excel.Application') excel.DisplayAlerts = false workbook = excel.Workbooks.Open('D:AKFWorkingCodePOC.xls') #Loop through the worksheets for i in 1 .. workbook.Worksheets.Count worksheet = workbook.Worksheets(i) rowcount = worksheet.UsedRange.Rows.Count for j in 2..rowcount Keyword =worksheet.Cells(j, 1).value Object_Prop_Name = worksheet.Cells(j, 2).value Object_Prop_Value = worksheet.Cells(j, 3).value Expected_Output = worksheet.Cells(j, 4).value Parm_01 = worksheet.Cells(j, 6).value case Keyword when /^OpenURL/ @Browser=IE.start(Parm_01) @Browser.maximize when /^SetText/ @Browser.text_field(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).set(Parm_01) when/^ClickButton/ @Browser.button(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).click when/^ClickLink/ @Browser.link(:quot;#{Object_Prop_Name}quot;, Object_Prop_Value).click when/^CloseURL/ @Browser.close
  • 5. when/^Result/ Actual_Output=verify_text(Expected_Output,quot;Passquot;,quot;Failquot;) worksheet.Cells(j, 5)['Value']=Actual_Output time_stamp_s = Time.new.strftime('%m%d_%H%M_%S') screenshot_filename=quot;#{time_stamp_s}_#{Expected_Output}quot;+quot;.jpgquot; screen_capture(screenshot_filename,active_window_only=false, save_as_bmp=false) worksheet.Cells(j, 7)['Value']=screenshot_filename workbook.SaveAs('D:AKFWorkingCodePOC.xls') else quot;Exitquot; end end end workbook.Close() excel.quit() rescue workbook.Close() excel.quit() end Step 7: Following will be output of excel after executing above script. Objec Actua t Expecte l Prop d Outpu Keyword Name Object Prop Value Output t Parm_01 Screenshot_Name http://www.google.co. OpenURL in/ SetText name q Astadia ClickButto n value Google Search http://www.astadia.co ClickLink href m/ 0521_1613_55_Astadia.j Result Astadia Pass pg Author Biography:
  • 6. Hirday is currently working as Sr. Manager (QA & CS) in Astadia. He has more than 9 years of IT experience. He is responsible for competency development of the Testing Group in Astadia. Hirday is M.S.(Computer Science) from Widener University, USA. He has worked on development and implementation of software test planning and framework for test automation on .NET platform. He can be reached at hlamba@astadia.com