FEATURES OF THE PROJECT STRUCTURE WITH USING THE PAGE OBJECT AND PAGE FACTORY DESIGN PATTERNS
DOI:
https://doi.org/10.32689/maup.it.2022.4.2Keywords:
project, design pattern, Page Object, Page Factory, auto-test, web element, web application, frameworkAbstract
The article is devoted to the study of the features of the project structure using the Page Object and Page Factory design patterns for writing auto-tests. The object-oriented programming language Java was chosen as the programming language, and the projects were created in IntelliJ IDEA. The test case of creating a new account on the site is considered. Corresponding auto-tests are written using the PageObject and PageFactory design patterns and using Selenium-java, WebDriverManager and the TestNG framework. Information that is necessary for successfully creating a new account on the site is read from a file with the extension properties and stored in the resources folder. A report on the success of passing the presented auto-test is created. Each page of the web application is represented by a separate class that contains the methods that work with them. Web elements are hidden (private) and stored separately in the project, where only the Page Object design pattern is used. Page class methods return new page class objects according to the written test script. The auto-test script is separated from web elements and methods simulating user actions. Also using the @BeforeSuite, @AfterSuite and @BeforeClass annotations, methods are created that correspond to the start and end of each test suite. The structures of projects using the Page Object and Page Factory patterns are given. Since the Page Factory design pattern is well-optimized and is used to initialize page objects or to create the page object itself, it simplifies the project structure. The web elements of the corresponding pages are stored in the corresponding classes, not separately from them.
References
Yoni Flenner. Page Object Model-Make It Simple, Use Abstraction. URL: https://blog.testproject.io/2017/07/16/page-object-model/ [in English]
Graham D., Black R., Erik van Veenendal. Foundations of Software Testing: ISTQB Certification, 4 th Edition. United Kingdom : EMEA, 2018. 273 p. [in English]
Anton Angelov, “Design Patterns for High-Quality Automated Tests: High-Quality Test Attributes and Best Practices”. United States: Kindle Edition, 2021. 348 p. [in English]
Erich Gamma, Richard Helm, Ralph Johnson, John Vissdes, "Design Patterns: Elements of Reusable Object-Oriented Software". United States: Addison-Wesley, 1994. 395 p. [in English]
Seretta Gamba, Dorothy Graham, “A Journey through Test Automation Patterns: One team’s adventures with the Test Automation Patterns”. United States: CreateSpace Independent Publishing Platform, 2018. 364 p. [in English]
Page Object Model (POM). URL: https://www.geeksforgeeks.org/page-object-model-pom/ [in English]
Amir Ghahrai. Page Object Model Framework with Java and WebDriver. URL: https://devqa.io/page-objectframework-java-webdriver/ [in English]
Krishna Rungta. Page Object Model (POM) & Page Factory in Selenium. URL: https://www.guru99.com/page-objectmodel-pom-page-factory-in-selenium-ultimate-guide.html [in English]
Selenium and TestNG. URL: https://testng.org/doc/selenium.html [in English]
Gunjan Kaushik, Ravinder Singh. Page Object Model using Page Factory in Selenium WebDriver. URL: https://www.toolsqa.com/selenium-webdriver/page-factory-in-selenium/ [in English]