Design Patterns in Test Automation




Page Object Pattern


  • PageObject Element Map 
    • Properties of all web elements of the page and their locators
  • Page Object
    • Actions of the page
  • Page Object Validator
    • Validations/Assertions on the page
  • Tests Class 
    • Group of tests referencing the page objects, it can hold only a single instance of the page object. 


Facade Design Pattern


  • Facade
    • Holds methods that combine actions executed on multiple pages
  • Page Objects (ItemPage)
    • Holds the actions that can be performed on the page like Search and Navigate. Exposes an easy access to the Page Validator though the Validate() method. 
  • PageObject Element Map 
    • Properties of all web elements of the page and their locators
  • Page Object Validator
    • Validations/Assertions on the page
  • Tests Class 
    • Group of tests referencing the facade, it can hold only a single instance of the facade.


Singleton Design Pattern


  • Page Objects (ItemPage)
    • Holds the actions that can be performed on the page like Search and Navigate. Exposes an easy access to the Page Validator though the Validate() method. 
  • PageObject Element Map 
    • Properties of all web elements of the page and their locators
  • BasePage
    • Gives access to the child’s page element map class and defines a standard navigation operation.
  • BasePage 
    • Adds an instance to the child page’s validator class through the Validate method.
  • BaseSingleton 
    • This is an abstract class that provides a static property of its child instance.



Fluent Page Object Design Pattern


  • Page Objects (ItemPage)
    • Holds the actions that can be performed on the page like Search and Navigate. Exposes an easy access to the Page Validator though the Validate() method. 
  • BasePage
    • Gives access to the child’s page element map class and defines a standard navigation operation.
  • BasePage 
    • Adds an instance to the child page’s validator class through the Validate method.
  • BaseSingleton 
    • This is an abstract class that provides a static property of its child instance.
  • BaseElementMap
    • Provides easier access to current browser and functions to switch between different frames.
  • BasePageValidator
    • Gives all child validators instance to the current element map and the page object itself.

Source:  https://dzone.com/articles/observer-design-pattern-design

Comments

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?