If you use Selenium or Rest Assured with Java, you
MUST know these TestNG annotations.
Execution order:@BeforeSuite → @BeforeTest → @BeforeClass → @BeforeMethod → @Test → @AfterMethod → @AfterClass → @AfterTest → @AfterSuite
Most used annotations:
@Test - marks a method as a test case
@BeforeMethod — runs before each test (e.g. launch browser)
@AfterMethod - runs after each test (e.g. close browser)
@BeforeClass — runs once before all tests in a class
@DataProvider — enables data-driven testing
@Parameters — pass values from XML config
@Groups - group test cases (smoke, regression)
Pro tips:
→ Use groups={"smoke"} for quick sanity runs
→ Use depends On Methods for sequential test flows
→ Use enabled=false to temporarily skip a test
→ Use priority to control execution order
Learning Selenium Automation: Understanding Page Object Model (POM)
As I continue my journey in QA Engineering and Test Automation, I explored one of the most important design patterns used in Selenium frameworks — Page Object Model (POM).
As I continue my journey in QA Engineering and Test Automation, I explored one of the most important design patterns used in Selenium frameworks — Page Object Model (POM).
POM
đš What is POM?
Page Object Model is a Selenium design pattern where each web page of an application is created as a separate class containing:
✔ Web elements
✔ Locators
✔ Page actions/methods
✔ Reusable automation logic
Instead of writing all Selenium code inside test cases, POM helps separate test logic from page implementation.
⚙️ How POM works:
Test Scripts
⬇️
Page Classes
⬇️
Web Elements
⬇️
Web Application
For example:
LoginPage → handles login actions
ProductPage → handles product operations
CartPage → handles cart functionality
The test cases simply call these reusable methods.
đĄ Benefits of POM:
✅ Better code readability
✅ Reduces code duplication
✅ Easy maintenance when UI changes
✅ Improves reusability
✅ Helps build scalable automation frameworks
đ Common tools used with POM:
Selenium WebDriver
Java
TestNG
Maven
Git/GitHub
Jenkins
Currently applying these concepts while building my E-Commerce QA Automation Suite, combining manual testing concepts with automation best practices.
Every automation framework starts with writing code, but great frameworks come from writing maintainable code. đ
đš What is POM?
Page Object Model is a Selenium design pattern where each web page of an application is created as a separate class containing:
✔ Web elements
✔ Locators
✔ Page actions/methods
✔ Reusable automation logic
Instead of writing all Selenium code inside test cases, POM helps separate test logic from page implementation.
⚙️ How POM works:
Test Scripts
⬇️
Page Classes
⬇️
Web Elements
⬇️
Web Application
For example:
LoginPage → handles login actions
ProductPage → handles product operations
CartPage → handles cart functionality
The test cases simply call these reusable methods.
đĄ Benefits of POM:
✅ Better code readability
✅ Reduces code duplication
✅ Easy maintenance when UI changes
✅ Improves reusability
✅ Helps build scalable automation frameworks
đ Common tools used with POM:
Selenium WebDriver
Java
TestNG
Maven
Git/GitHub
Jenkins
Currently applying these concepts while building my E-Commerce QA Automation Suite, combining manual testing concepts with automation best practices.
Every automation framework starts with writing code, but great frameworks come from writing maintainable code. đ
No comments:
Post a Comment