Anzeige

Making Watir and Cucumber an efficient tool for Web UI Automation

Senior Test Automation Engineer at Severalnines um Severalnines
2. Mar 2015
Anzeige

Más contenido relacionado

Anzeige
Anzeige

Making Watir and Cucumber an efficient tool for Web UI Automation

  1. Making Watir and Cucumber an efficient tool for Web UI Automation Ruslan Strazhnyk nCryptedCloud
  2. About Me Ruslan Strazhnyk  Rich experience in creating Test Automation Frameworks - Front-end, Back-end, API, Load Testing  Languages: Ruby, Python, Java, JS  Technologies: Selenium, REST, CI, Jenkins, Jmeter
  3. So many Frameworks?!
  4. Why Not Robot Framework?  Pros  Similar to BDD/ATDD test writing  Page Object implemented through Selenium2library plugin  Possible to write extensions in Python  Produces output in html  Cons  Requires building own framework (with extensions)  Requires learning RF own language for writing test scenarios  Indirect webdriver support through Selenium2library  Tests are written in txt files
  5. Experience with RF
  6. Robot Framework
  7. Robot Framework
  8. Why not Behave?  Pros  BDD/ATDD is supported through Gherkin  Libraries in Python  Produces output in json and html  Latest webdriver library supported  More cucumber-like, better than RF in keyword logic  Cons  Page Object is not supported out-of-the-box  Building custom framework layer required  Only basic usage tutorials are available
  9. Behave
  10. Behave
  11. Why not some fancy JS Framework? Node.js + protractor.js + webdriver.js  Pros  BDD/ATDD is supported through Gherkin in cucumber.js  Page-object through protractor.js  Fresh and buzzy  Robustly works with angular applications  Output in html and json  Cons  Strong knowledge of JS required  Only some basic tutorials available  Immature frameworks, too many of them  Has a high-entry point, more optimized for e2e testing
  12. JavaScript Frameworks
  13. JavaScript Frameworks
  14. JavaScript Frameworks
  15. Why Ruby/Cucumber/PageObje ct/Watir?  Pros  Full support of Cucumber  Advanced Page-Object framework as a gem  Rspec makes mocking and assertion more advanced  Excellence of both watir and webdriver  Nice book fromJeff Morgan – “Cucumber and Cheese”  Cons  Can be a separate language stack  Learn other ruby gems for things like mysql, ssh and so on
  16. Advantages of Watir  No xpath  No Selenium IDE  The power or Ruby  Rich API
  17. Page-object gem for Ruby  https://github.com/cheezy/page-object  Assists in creating flexible page-objects for testing browser based applications  Facilitates creation of abstraction layers in the tests and makes decoupling easy  Provides simple API interface to the elements on a page
  18. Page-object gem for Ruby  Works with both watir-webdriver and selenium- webdriver  Robust way of dealing with Ajax Calls  A clean way of handling JavaScripts pop-ups  A simple way of dealing with Frames and iFrames  Supports most HTML elements
  19. Page Object Define new page object Add some methods, let’s say for login page
  20. Creating Page Object It is possible to create higher level methods that hide implementation details even further So usage of the page would become
  21. Page Object Elements  Button  Cell  Checkbox  Div  FileField ttps://github.com/cheezy/page-object/wiki/Elements  Form  H1, H2, H3, H4, H5, H6  Hidden Field  Image  Link
  22. Page Object Elements ttps://github.com/cheezy/page-object/wiki/Elements  ListItem  OrderedList  Paragraph  RadioButton  SelectList (Dropdown)  Span  Table  TableCell  TextArea/TextField  UnorderedList
  23. Hooks  Scenario hooks  Before  After  Around  Step hooks  Tagged hooks  Global hooks  AfterConfiguration
  24. Hooks Before and After hooks
  25. Tagging  You can use tags to mark your scenarios  Some tags are user for hooks  There could be many tags for one scenario  Effective execution of needed test scenarios
  26. Tagging
  27. Scenario vs. Scenario Outline  Use different values instead of multiplying scenarios  Allows to more concisely express the example through the use of placeholders  Scenario Outline steps provide a template which is never directly run  Problematic for some cucumber Reporting plug-ins in Jenkins
  28. Scenario vs. Scenario Outline
  29. Advanced element usage File Upload (steps and step definitions)
  30. Advanced element usage File Upload (function)
  31. Advanced element usage Looping through file links
  32. Advanced features: iFrame, inFrame
  33. Advanced features: iFrame, inFrame
  34. Advanced features: JS Pop-ups Alert, Confirm, Prompt
  35. Continuous Integration with Jenkins  RVM plugin for executing tests in RVM env  Cucumber-reports or Cucumber Test Result Plugin for reporting  Xvfb plugin for running tests headless  Build With Parameters for manual execution using different param
  36. Continuous Integration with Jenkins
  37. Continuous Integration with Jenkins
  38. Questions? Ideas? Follow-up? • Twitter @strazhnyk • Skype ruslanstrazhnyk • Email strazhnyk@gmail.com • LinkedIn ruslanstrazhnyk
Anzeige