SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

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