https://github.com/nuwanthikaishani/seleniumtestdata
Managing test data efficiently is a significant aspect of any testing strategy, and I wanted to demonstrate how Apache POI can be leveraged to read and use data from Excel in Selenium-based tests.
https://github.com/nuwanthikaishani/seleniumtestdata
java pom selenium seleniumwebdriver testdata
Last synced: 4 months ago
JSON representation
Managing test data efficiently is a significant aspect of any testing strategy, and I wanted to demonstrate how Apache POI can be leveraged to read and use data from Excel in Selenium-based tests.
- Host: GitHub
- URL: https://github.com/nuwanthikaishani/seleniumtestdata
- Owner: nuwanthikaishani
- Created: 2025-03-08T19:18:28.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-08T20:33:30.000Z (11 months ago)
- Last Synced: 2025-04-12T17:22:17.713Z (10 months ago)
- Topics: java, pom, selenium, seleniumwebdriver, testdata
- Language: Java
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SeleniumTestData
# Selenium Test Data Management with Page Object Model (POM)
This project demonstrates how to manage **test data** using **Apache POI** (Excel) in a **Selenium-based test automation framework** built with the **Page Object Model (POM)**. The project is designed to separate **test data** from test scripts, making it more maintainable, scalable, and reusable for data-driven testing.
## **Project Structure**
This project follows the **Page Object Model (POM)** design pattern, where:
- **Page Object** classes represent the user interface.
- **Test classes** manage the test execution.
- **Utility classes** help with repetitive tasks like reading test data from Excel.
Here’s the folder structure:
SeleniumPOMTestProject/ │── src/ │ ├── main/ │ │ ├── java/ │ │ │ ├── base/ │ │ │ │ ├── BaseTest.java │ │ │ ├── pages/ │ │ │ │ ├── LoginPage.java │ │ │ ├── utils/ │ │ │ │ ├── ExcelReader.java │ │ ├── resources/ │ │ │ ├── config.properties │ │ │ ├── TestData.xlsx │ ├── test/ │ │ ├── java/ │ │ │ ├── tests/ │ │ │ │ ├── LoginTest.java │── pom.xml │── testng.xml │── README.md
## **Key Components**
### **1. BaseTest.java**
The `BaseTest` class initializes the WebDriver, sets the browser configurations, and manages the test setup and teardown. This class is extended by other test classes to avoid code duplication.
### **2. LoginPage.java**
The `LoginPage` class is a Page Object that contains the locators for the login form (username, password, login button) and the methods to interact with the login page.
### **3. ExcelReader.java**
The `ExcelReader` utility class uses **Apache POI** to read test data from an Excel file. It abstracts the logic of reading test data from the Excel sheet so that the test classes can easily fetch data for different test cases.
### **4. LoginTest.java**
The `LoginTest` class is the actual test case that reads data from the Excel file using the `ExcelReader` class and performs the login functionality using the methods from the `LoginPage` class.
### **5. TestData.xlsx**
The `TestData.xlsx` file contains the test data for the login functionality (e.g., valid usernames and passwords). This file is used to perform **data-driven testing**.
### **6. config.properties**
A configuration file used to store **browser settings**, **URLs**, and other configurable parameters.
---
## **Getting Started**
### **1. Clone the Repository**
First, clone this repository to your local machine:
```bash
git clone https://github.com/nuwanthikaishani/SeleniumTestData.git