top of page
Search
Writer's pictureTuyen Nguyen

Page Object Model Pattern

Updated: Jul 29, 2024

Intro


This is my first article in the series "Design Patterns in Automated Testing", which gives you the most popular and useful techniques for designing automation tests. And we come to Page Object Model (Page Object Pattern), the most used design pattern for enhancing test maintenance and reducing code duplication.


What is Page Object Model - POM?


Page Object Model is a design pattern to create an "object repository" for WebUI elements. It wraps all elements, actions, validations happening on a page in one single object - Page Object. Under this model, for each web page in the application, there should be the corresponding page class.


UML Class Diagram

Google Calculator Test - UML Class Diagram

Participants


The classes and objects relating in this pattern are:

  • Page Object (GoogleCalculatorPage): contains properties of all necessary web elements of the page, the methods which perform operations on those elements and validators for comparing the expected results.

  • Test Class (GoogleCalculatorTest): contains a group of test cases related to given page. It can hold only one instance of the described page object.




925 views0 comments

Commentaires


bottom of page