Page-Object pattern for creating a Test Automation Framework
Page-Object pattern is one of the most effective approaches for creating a Test Automation Framework. This pattern maps a GUI page to a page class and the functionality to interact about the page is captured within the Page class (i.e., a new page class created for each new web page). So, you are calling the page class methods that perform action on the web page in your tests.
Test maintenance becomes easier by creating a Base Page class as it contains most common functions that need to be performed on any web page. For example: If need to navigate to a webpage in many of my tests, I may define this in my Base Page Class and then my Page Class must inherit this.
Advantages of using Page-Object pattern in Selenium:
- Test code is easily readable.
- Distinguished reusable code.
- No duplication of Selenium API calls.
- Creation of tests are easy and improves maintainability.
- Used effectively with IDE such as Visual Studio, Eclipse, IntelliJ, Visual Studio.
- Excellent support for languages such as C#, Java, Ruby, Python, Perl.