Notes while learning from testautomationguru.com (THANKS!) which need strong development skills ;) With help of Katalon, seems most best practices could be implemented :) Keep the summary to remind best practices will always help!
1. Page Objects Model, + Arquillian Framework
- Page Objects: Page objects is a well known design pattern, widely accepted by the automation engineers, to create separate class file for each page of the application to group all the elements as properties and their behaviors / business functionalities as methods of the class. But it might not be a great idea always, especially when the page has more / different sets of elements / complex element like a grid / calendar widget / a HTML table etc. ex http://www.testautomationguru.com/keyword-driven-framework-for-localization-testing-using-selenium-webdriver/ (Table/keyword driven + page objects model)
- Selenium WebDriver – Blackbox Automated Testing using Arquillian Framework
- Selenium WebDriver – Advanced Page Object Pattern with Page Fragments using Arquillian Graphene (Single Responsibility Principle)
2. No hard code of test data: Selenium WebDriver – How To Design Tests & Test Data
3. Design patterns in Test Automation: http://www.testautomationguru.com/category/design-pattern/
"Note: Your aim should not be to implement a certain pattern in your framework. Instead, identify a problem in the framework and then recognize the pattern which could be used to solve the problem. Do not use any design pattern where it is not really required!!"
- Creational patterns - Factory Pattern (Driver Manager Factory)
- Behavioral patterns - Strategy Design Pattern (Text or Voice search)
- Behavioral patterns - Template Method Pattern (Car and Hotel reservation)
- Structural Patterns - Proxy Pattern (Run selected test on Production env.)
- Structural Patterns - Decorator Design Pattern (Decorator pattern allows us to add additional responsibilities to an object dynamically. By using decorator pattern, we create page objects with dynamic components based different roles. In future, if the application adds another component or another role type, it is extremely easy to update the test.) (Used Java8 Consumer Functional Interface for better readability)
- Behavioral Patterns - Chain Of Responsibility Design Pattern (Whole online shopping process)
- Execute Around Method Pattern (execute around method pattern hides the complex logic of switching to frames / windows etc. The user does not have to worry about switching and instead just focuses on business logic. It makes both page objects and test classes look clean and neat.)
Refer to https://sourcemaking.com/design_patterns or http://www.oodesign.com/ for design patterns.
4. WebDriver in Fluent Style (java 8 Stream)
Selenium WebDriver – How To Design Page Objects In Fluent Style
5. Test Suite Management:
(By creating a custom annotation and using TestNG’s listener, We are able to skip methods without any issues and maintains the order the test execution.)
Or by Selenium WebDriver – Design Patterns in Test Automation – Proxy Pattern (Filter test env in proxy)
No comments:
Post a Comment