FireWatir - Web Application Testing Using Ruby and Firefox

  • 14,732 views
Uploaded on

FireWatir is a tool used for functional testing a web application using Ruby and Firefox browser. You can use the scripts written using WATiR that targets IE with slight changes with FireWatir

FireWatir is a tool used for functional testing a web application using Ruby and Firefox browser. You can use the scripts written using WATiR that targets IE with slight changes with FireWatir

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Actually those are the scripts that were not incorporated in the presentation. Let me know if you need them.
    Are you sure you want to
    Your message goes here
  • Why can i see nothing other than the title on the pages where it says example 'air deccan or indigo or any of the examples ?'
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
14,732
On Slideshare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
90
Comments
2
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. FireWatir - Web Application Testing Using Ruby & Firefox
    • Angrez Singh
    • Proteans Software Solutions Pvt. Ltd.
  • 2. Motivation
    • Web Applications are increasingly ubiquitous as a functionality delivery paradigm.
    • Testing Web Applications is important
    • Web-Application specific test functionality in commercial test tools leaves much to be desired.
      • …and they cost a bomb.
  • 3. Problems with existing Tools
    • Most provide record-and-replay style test automation functionality.
      • Semantic Gap
      • Little or no support for web application specific test functionality
    • Vendor specific scripting languages (“Vendorscript”)
  • 4. What is Ruby?
    • Purely Object Oriented scripting language
    • Everything is an Object as in Java
    • Scripting language features
      • Full Regular expression support
      • Tight integration with OS
      • Dynamic evaluation
    • References
      • http://www.rubycentral.com
      • http://www.ruby-lang.org
      • http://www.rubygarden.org/ruby
      • http:// tryruby.hobix.com /
  • 5. What is FireWatir?
    • Testing Web Application using Ruby and Firefox browser
    • Framework / Library for scripting Web application testing cases
    • Functional testing tool for automated browser-based tests
  • 6. Example Yahoo Mail
  • 7. Conceptual Framework
    • Class for Firefox
    • Classes for each element
      • (e.g. image, link, checkbox etc)
    • Selection mechanism for elements
      • (e.g. index, id, name, value etc)
  • 8. Firefox Class
    • Active methods
      • goto()
      • back()
      • refresh() etc.
    • Methods that provide current state
      • url()
      • title()
      • contains_text() etc
  • 9. Element Class
    • Base class for all Elements
    • Provides common methods
      • click()
      • enabled?
      • exists?
    • Selection Mechanism
      • index, id, name, value etc
  • 10. Checkbox & Radiobutton Class
    • Summary
      • Used to access checkbox & radiobutton
    • Methods
      • set, clear
      • For e.g.:
      • <input type=“checkbox” name=“checkbox1”>
      • ff.checkbox(:name, “checkbox1”).clear
      • <input type=“checkbox” name=“order” value=“order1”>
      • <input type=“checkbox” name=“order” value=“order2”>
      • ff.checkbox(:name, “order”, “order1”).set
  • 11. SelectList Class
    • Summary
      • Used to select value from listbox, dropdownlist
    • Methods
      • option, select, select_item_in_select_list
      • For e.g.:
      • <select name=“selectBox”>
      • <option value=“1”>1</option>
      • </select>
      • ff.select_list(:name, “selectBox”).select(“1”)
  • 12. Text Field Class
    • Summary
      • Used for accessing text box
    • Methods
      • append, maxLength, set, size etc.
      • For e.g.:
      • <input type=“text” name=“UserName” id=“txtUserName”>
      • ff.text_field(:name,”UserName”).set(“set value”)
  • 13. Image Class
    • Summary
      • Use to access image
    • Methods
      • height, width etc.
    • Selection mechanism
      • index, name, id, alt, src
      • For e.g.:
      • <img name=“myimage” alt=“A picture” src=“/images/mypic.jpg“>
      • ff.image(:alt, “A picture”).height()
  • 14. Example Airdeccan
  • 15. Button class
    • Summary
      • Used to access button on page
    • Selection mechanism
      • caption
      • For e.g.:
    • <input type=“button” id=“btnSearch” name=“search” value=“Search”>
    • ff.button(:name,”search”).click
    • ff.button(:id,”btnSearch”).exists?
  • 16. Link Class
    • Summary
      • Used to access link
    • Methods
      • innerText, src etc
    • Properties
      • href
    • Selection mechanism
      • url, text, title
      • For e.g.:
      • <a href=“ http:// www.google.com ” title=“Go to Google”>
      • ff.link(:title, “Go to Google”).src
      • ff.link(:title, “Go to Google”).link_has_image
  • 17. XPath Selection Mechanism
    • Language for addressing parts of XML document
    • Used to navigate through elements
    • DOM model is represented using Tree like structure
    • XPath is used to select element in DOM Tree
    • References
      • http://www.w3schools.com/xpath/default.asp
  • 18. Selection Mechanism
    • Exact string match
      • ff.text_field(:name, ”txtUserName”)
    • Regular Expression
      • ff.text_field(:name, /txtUserName/)
    • XPath expression
      • ff.text_field(:xpath, “//input[@name=‘txtUserName’]/”)
      • ff.element_by_xpath(“//area[id=‘area1’]/”)
  • 19. Example Indigo
  • 20. How FireWatir interacts?
    • Uses JSSh extension
    • Runs at port 9997 and listens for commands
    • Firewatir sends JavaScript commands via socket
    • Read back the results
  • 21. Advanced Concepts
    • Handling Windows pop up
      • Use attach method of Firefox using title
      • Get a new Firefox instance
      • Use this Firefox instance for accessing elements in pop up window
      • For e.g.:
      • newFF = ff.attach(:title, “Google”)
      • newFF.button(:name, “Search”)
  • 22. Handling Javascript Pop ups
    • Redefines the function alert and confirm in JavaScript
    • JSSh doesn’t get blocked
      • For e.g.:
    • ff.button(:name, /Sign In/).click_no_wait
    • ff.click_jspopup_button(button)
  • 23. Advanced Concepts - Example
  • 24. Advantages
    • In built XML and XPath support
    • More compliant to standards
    • Can support Linux, Mac platform
    • Made to run on any client machine
  • 25. References
    • FireWatir home page
      • http://code.google.com/p/firewatir/
    • JSSh home page
      • http://croczilla.com/jssh/
    • Element References
      • http://www.xulplanet.com/references/elemref/
    • Download XPI’s
      • http://people.mozilla.com/~davel/jssh/
  • 26. Q & A