Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
FireWatir - Web Application Testing Using Ruby & Firefox <ul><li>Angrez Singh </li></ul><ul><li>Proteans Software Solution...
Motivation <ul><li>Web Applications are increasingly ubiquitous as a functionality delivery paradigm. </li></ul><ul><li>Te...
Problems with existing Tools <ul><li>Most provide record-and-replay style test automation functionality. </li></ul><ul><ul...
What is Ruby? <ul><li>Purely Object Oriented scripting language </li></ul><ul><li>Everything is an Object as in Java </li>...
What is FireWatir? <ul><li>Testing Web Application using Ruby and Firefox browser </li></ul><ul><li>Framework / Library fo...
Example Yahoo Mail
Conceptual Framework <ul><li>Class for Firefox </li></ul><ul><li>Classes for each element </li></ul><ul><ul><li>(e.g. imag...
Firefox Class <ul><li>Active methods </li></ul><ul><ul><li>goto() </li></ul></ul><ul><ul><li>back() </li></ul></ul><ul><ul...
Element Class <ul><li>Base class  for all Elements </li></ul><ul><li>Provides  common methods </li></ul><ul><ul><li>click(...
Checkbox & Radiobutton Class <ul><li>Summary </li></ul><ul><ul><li>Used to access checkbox & radiobutton </li></ul></ul><u...
SelectList Class <ul><li>Summary </li></ul><ul><ul><li>Used to select value from listbox, dropdownlist </li></ul></ul><ul>...
Text Field Class <ul><li>Summary </li></ul><ul><ul><li>Used for accessing text box </li></ul></ul><ul><li>Methods </li></u...
Image Class <ul><li>Summary </li></ul><ul><ul><li>Use to access image </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li...
Example Airdeccan
Button class <ul><li>Summary </li></ul><ul><ul><li>Used to access button on page </li></ul></ul><ul><li>Selection mechanis...
Link Class <ul><li>Summary </li></ul><ul><ul><li>Used to access link </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>...
XPath Selection Mechanism <ul><li>Language for addressing parts of XML document </li></ul><ul><li>Used to navigate through...
Selection Mechanism <ul><li>Exact string match </li></ul><ul><ul><li>ff.text_field(:name, ”txtUserName”) </li></ul></ul><u...
Example Indigo
How FireWatir interacts? <ul><li>Uses JSSh extension </li></ul><ul><li>Runs at port 9997 and listens for commands </li></u...
Advanced Concepts <ul><li>Handling Windows pop up </li></ul><ul><ul><li>Use attach method of Firefox using title </li></ul...
Handling Javascript Pop ups <ul><li>Redefines the function alert and confirm in JavaScript </li></ul><ul><li>JSSh doesn’t ...
Advanced Concepts - Example
Advantages <ul><li>In built XML and XPath support </li></ul><ul><li>More compliant to standards </li></ul><ul><li>Can supp...
References <ul><li>FireWatir home page </li></ul><ul><ul><li>http://code.google.com/p/firewatir/ </li></ul></ul><ul><li>JS...
Q & A
Upcoming SlideShare
Loading in …5
×

FireWatir - Web Application Testing Using Ruby and Firefox

15,435 views

Published 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

Published in: Economy & Finance, Technology
  • Actually those are the scripts that were not incorporated in the presentation. Let me know if you need them.
       Reply 
    Are you sure you want to  Yes  No
    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 ?'
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

FireWatir - Web Application Testing Using Ruby and Firefox

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

×