Technology Stack
The framework is built using the following industry-standard technologies.
| Component | Purpose |
|---|---|
| Java | Programming Language |
| Selenium WebDriver | Browser Automation |
| TestNG | Test Execution & Assertions |
| Maven | Dependency Management & Build Tool |
| Page Object Model (POM) | Framework Design Pattern |
| Log4j | Logging |
| Extent Reports | HTML Reporting |
| Apache POI | Excel Data Handling |
Step-by-Step Project Creation
Step 1 – Create a Maven Project
Create a new Maven Project from your IDE.
File → New → Maven Project
Step 2 – Update the pom.xml File
Add all required dependencies.
- Selenium WebDriver
- TestNG
- Extent Reports
- Log4j
- Apache POI
Overall Framework Development Flow
The complete framework development follows these steps.
- Understand the project requirements.
- Decide the framework type (Hybrid / POM).
- Create the project structure.
- Add required tools and dependencies.
- Configure project settings.
- Develop reusable base and utility classes.
- Create Page Object Model classes.
- Write automation test cases.
- Configure reporting and logging.
- Implement screenshots and parallel execution.
- Integrate with CI/CD.
Framework Folder Structure
src
│
├── main
│ └── java
│ ├── base
│ │ └── BaseTest.java
│ │
│ ├── config
│ │ └── ConfigReader.java
│ │
│ ├── pages
│ │ ├── LoginPage.java
│ │ ├── HomePage.java
│ │ ├── ProductPage.java
│ │ ├── CartPage.java
│ │ └── CheckoutPage.java
│ │
│ └── utils
│ ├── BrowserFactory.java
│ ├── WaitUtils.java
│ └── ScreenshotUtil.java
│
├── test
│ ├── java
│ │ └── tests
│ │ ├── LoginTest.java
│ │ ├── AddToCartTest.java
│ │ └── CheckoutTest.java
│ │
│ └── resources
│ ├── config.properties
│ └── testng.xml
│
└── pom.xml
Folder Description
Base
Contains driver initialization and browser setup.
Example:
- BaseTest.java
Config
Contains configuration classes.
Example:
- ConfigReader.java
Pages
Contains all Page Object Model classes.
Examples:
- LoginPage
- HomePage
- ProductPage
- CartPage
- CheckoutPage
Utils
Contains reusable utility classes.
Examples:
- BrowserFactory
- WaitUtils
- ScreenshotUtil
Tests
Contains all automation test classes.
Examples:
- LoginTest
- AddToCartTest
- CheckoutTest
Resources
Contains configuration files.
Examples:
- config.properties
- testng.xml
Configuration File
The config.properties file stores application configuration so that values are not hardcoded.
url=https://demo.opencart.com
browser=chrome
username=testuser@email.com
password=Test@123
The ConfigReader.java class reads these values during runtime.
This allows changes such as:
- Browser
- URL
- Username
- Password
without modifying the automation code.
BaseTest – Driver Initialization
The BaseTest.java class is responsible for:
- Initializing WebDriver
- Launching the browser
- Reading browser information from configuration
- Opening the application URL
- Closing the browser after execution
Every test class extends BaseTest, eliminating duplicate setup code.
Page Object Model – Complete E-Commerce Flow
The framework contains Page Object Model classes for every major page of the application.
LoginPage.java
Responsibilities:
- Enter Username
- Enter Password
- Login
Example Method
login(username, password)
SearchProductPage.java
Responsibilities:
- Search for a product
AddToCartPage.java
Responsibilities:
- Add product to cart
CartPage.java
Responsibilities:
- Update product quantity
- Proceed to Checkout
CheckoutPage.java
Responsibilities:
- Fill shipping details
- Complete checkout
Example Action
confirmOrder.click()
OrderConfirmationPage.java
Responsibilities:
- Validate successful order placement
POM Design
Each Page Object class contains:
- Private WebElements
- Public action methods
This follows the Page Object Model design pattern and encapsulation.
The test classes interact only with page methods instead of directly using Selenium WebDriver.
End-to-End Test Case
A typical automation test extends the BaseTest class and uses configuration values.
Example:
public class LoginTest extends BaseTest {
public void verifyLogin() {
LoginPage lp = new LoginPage(driver);
lp.login(
ConfigReader.get("username"),
ConfigReader.get("password")
);
// Assertions
}
}
The complete automation flow continues through all page objects until order confirmation.
Complete E-Commerce Flow
The automation framework covers the complete customer journey.
Login
↓
Search Product
↓
Add To Cart
↓
Cart
(Update Quantity)
↓
Checkout
↓
Order Confirmation
This represents the complete end-to-end automation flow for an E-Commerce application.
Interview Explanation (4+ Years Experience)
In my project, I designed a Selenium Java Automation Framework using the Page Object Model. We use TestNG for test execution, Maven for dependency management, Extent Reports for reporting, and Log4j for logging. The framework follows a clean folder structure where Base handles driver initialization, Config manages application settings, Pages contain the Page Object Model classes, Utils store reusable helper classes, and Tests contain the automation scripts. The framework automates the complete E-Commerce workflow from Login to Order Confirmation. It is data-driven, supports parallel execution, captures screenshots for failed test cases, and is integrated with Jenkins for CI/CD execution.
Frequently Asked Questions
Which technologies are used in this framework?
The framework uses:
- Java
- Selenium WebDriver
- TestNG
- Maven
- Page Object Model (POM)
- Log4j
- Extent Reports
- Apache POI
What is the framework folder structure?
The framework consists of:
- src/main/java
- base
- config
- pages
- utils
- src/test/java
- tests
- src/test/resources
- config.properties
- testng.xml
- pom.xml
What is the purpose of BaseTest?
BaseTest is responsible for:
- Driver Initialization
- Browser Launch
- Reading Configuration
- Opening the Application
- Closing the Browser
All test classes extend BaseTest.
Which Page Object classes are included?
The framework includes:
- Login Page
- Search Product Page
- Add To Cart Page
- Cart Page
- Checkout Page
- Order Confirmation Page
How is configuration managed?
Configuration values such as:
- URL
- Browser
- Username
- Password
are stored in config.properties and accessed using ConfigReader.java, avoiding hardcoded values.