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.

Three approaches to optimizing your selenium test designs

3,696 views

Published on


ABOUT THE WEBINAR

One of the largest challenges with creating any test automation suite is simultaneously ensuring scalability, maintainability and reliability. To meet this challenge, an automation suite around Selenium needs to address the measurement and reporting of test coverage and test success, as well as build a strategy for change tolerance through object recognition and code maintainability.

Experts from Qualitest and Sauce Labs will explore different design approaches to test automation with Selenium and how they can help to ensure success across several key factors.

Published in: Software
  • Be the first to comment

Three approaches to optimizing your selenium test designs

  1. 1. © Sauce Labs, Inc. Three Approaches to Optimizing Your Selenium Test Designs Presented by QualiTest and Sauce Labs, Inc.11/4/2015
  2. 2. © Sauce Labs, Inc. Brian Van Stone – Solutions Architect, QualiTest Neil Manvar – Solutions Architect, Sauce Labs
  3. 3. © Sauce Labs, Inc.© Sauce Labs, Inc. Agenda Good design approaches with Selenium Different types of test designs • Page Object Model • Behavior Driven Development • Keyword Driven Design Pros and cons of design methodologies Q&A
  4. 4. © Sauce Labs, Inc. The Importance of Design • Key Success Factors in Test Automation • Strong Design • Consistency • Reliability • Benefits • Faster development • More accurate results • Reduced cost of maintenance • Ability to address absent features of Selenium
  5. 5. © Sauce Labs, Inc. Page Object Design Pattern • Definition: Model the UI components of your application as Page Objects which: • Expose the services of a page to the test developer • Abstract the deep knowledge of page structure away from the test • Disadvantages: • Cost of framework development • Not ideal for all applications • Some pages can be highly interactive and serve a very large amount of content • Requires a high degree of technical proficiency from the testing team • Advantages: • High tolerance of changes in the UI • Intuitive model for automating workflow driven functionality • Parallelism with other design patterns like MVC • Reduction in code duplication • Coupling of object recognition and app functionality
  6. 6. © Sauce Labs, Inc. Why Page Object? • Reasons to consider page object design: • Large amounts of workflow driven content that lends itself to page-by- page automation • Leveraging synergy with a development team employing the MVC design pattern • Separation of implementation from presentation reduces maintenance costs • Reasons to explore other options: • Large amounts of highly interactive single-page content. This is becoming less common than it once was. • Requirement or desire to involve non-technical SMEs in the test design and execution processes
  7. 7. © Sauce Labs, Inc. Page Object Sample and Further Discussion
  8. 8. © Sauce Labs, Inc. BDD • BDD = Behavior Driver Development • maintainable, readable, easy to debug • Test Automation Framework • Cucumber • Selenium-Webdriver • Page-Object • Selenium-Webdriver
  9. 9. © Sauce Labs, Inc. Testing using BDD Tools - Pro / Cons • Pros • Requirements and Behavior are clear • Can be read / understood by all • Easier to debug and maintain • Test case is from a “user” perspective • Cons • Another layer / technology that is introduced into tech stack • Onboarding – how to write proper step definitions, features, scenario outlines, regex’s, etc.
  10. 10. © Sauce Labs, Inc. Keyword Driven Testing (KDT) • Definition: Represent functionality to be tested as keywords which are executed in combination to model test behavior • Disadvantages: • Risk of dependency creation between keywords must be mitigated by design • Sometimes such dependencies are unavoidable • Maintenance costs are generally managed more by design than by technical savvy. • Addresses only application functionality rather than application objects • Requires additional design of an object recognition strategy • Advantages: • Strong and clear separation of design, data, and development • Capacity to understand test automation flow without much or any technical knowledge • Extreme abstraction of automation implementation
  11. 11. © Sauce Labs, Inc. Why KDT? • Reasons to consider KDT: • Culture and support structure tending towards business driven test design • Separation of design, data, and development • Organizational structure will sometimes lend these three categories to different existing roles in the organization • Requirement to have non-programming personnel interact with test automation (design, execution, or analysis) • Very easy to data-drive tests • Reasons to explore other options: • Large amounts of dependent functionality • You can model workflows in KDT but complex workflows can present issues • Desire to keep test automation technical and reduce design overhead
  12. 12. © Sauce Labs, Inc. KDT Sample and Further Discussion • Start with a generic keyword • Create a concept for an execution flow • Make sure keyword execution can handle exception cases • Devise a strategy for sharing data between keywords and/or tests
  13. 13. © Sauce Labs, Inc. KDT Sample and Further Discussion • Create the core of the framework that enables execution of tests • Create a primary driver class which can parse your input (driven by spreadsheet, xml files, JSON, etc.) • Control execution flow at the highest level here. Have a hierarchy of classes to support each level (Test Cases, Keywords, etc.) • The most light weight means of execution will be driving it through a main method and simply invoking it from the command line • Reflection is your friend
  14. 14. © Sauce Labs, Inc. KDT Sample and Further Discussion • With the core framework in place, build useful and reusable keywords • This is a prototype for a keyword that manages connections • Create an abstract class which manages connection creation/reuse during initialization • And manages connection cleanup/rollback during cleanup
  15. 15. © Sauce Labs, Inc. KDT Sample and Further Discussion • Create simple keywords leveraging abstract functionality • Keywords that perform a specific task should perform ONLY that task whenever possible • A specific keyword implementation should only care about the arguments unique to it • Reduce maintenance costs by eliminating boiler plate or common code
  16. 16. © Sauce Labs, Inc. Summary • Key Takeaways • Design, design, design • Focus on reducing maintenance costs • Choose the best fit
  17. 17. © Sauce Labs, Inc. Questions?
  18. 18. © Sauce Labs, Inc. More Info on Sauce Labs Resources • WhitePaper: How to get the most out of your CI / CD work flow with automated testing http://tinyurl.com/p5umo6p • Sauce Labs Docs – tutorials for writing scripts https://docs.saucelabs.com/ • Sign up for a free trial of Sauce https://saucelabs.com/signup/trial
  19. 19. © Sauce Labs, Inc. More Info QualiTest Resources • Check us out! http://www.qualitestgroup.com • See some stories of what we have done with Selenium! http://www.qualitestgroup.com/software-testing/testing-services-through-selenium/
  20. 20. © Sauce Labs, Inc. Thank you!

×