This project demonstrates a Data Driven Automation Framework built with Selenium WebDriver, TestNG, and Apache POI. It reads test data from an Excel file and executes the same test case with multiple data sets dynamically.
✅ Data-driven testing using Excel (Apache POI)
✅ Integration with TestNG @DataProvider
✅ Modular Maven project structure
✅ Reusable and scalable test design
✅ Easy to extend with WebDriver for UI testing
| Component | Technology |
|---|---|
| Language | Java |
| Automation Tool | Selenium WebDriver |
| Testing Framework | TestNG |
| Build Tool | Maven |
| Data Handling | Apache POI |
| IDE | Eclipse / IntelliJ |
datadriven/
├── src/
│ └── test/java/datadriven/datadriven.java
├── excelDriven.xlsx
├── pom.xml
└── testng.xml (optional)
- Excel file (
excelDriven.xlsx) contains input data (e.g., greetings, messages, IDs). - Apache POI reads data and stores it into a 2D Object array.
- TestNG’s
@DataProvidersupplies this data to the test method. - Test method executes once for each row of Excel data.
@DataProvider(name = "driveTest")
public Object[][] getData() throws IOException {
FileInputStream fis = new FileInputStream("C:\\Users\\Admin\\Documents\\excelDriven.xlsx");
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheetAt(0);
int rowCount = sheet.getPhysicalNumberOfRows();
XSSFRow row = sheet.getRow(0);
int colCount = row.getLastCellNum();
Object data[][] = new Object[rowCount - 1][colCount];
DataFormatter formatter = new DataFormatter();
for (int i = 0; i < rowCount - 1; i++) {
row = sheet.getRow(i + 1);
for (int j = 0; j < colCount; j++) {
XSSFCell cell = row.getCell(j);
data[i][j] = formatter.formatCellValue(cell);
}
}
wb.close();
fis.close();
return data;
}| greeting | communication | id |
|---|---|---|
| Hello | 101 | |
| Hi | Call | 102 |
Output:
Hello Email 101
Hi Call 102
-
Clone this repository:
git clone https://github.com/<your-username>/Selenium-DataDriven-Framework.git
-
Import as Maven Project into Eclipse or IntelliJ.
-
Update your Excel file path if needed.
-
Run the test as TestNG Test.
- Integrate Selenium WebDriver for live UI automation
- Add Extent Reports for visual reporting
- Implement Page Object Model (POM) structure
- Jenkins CI/CD pipeline setup
👤 Taran Singh 📧 writetotaransingh@gmail.com 💻 Passionate about Test Automation and Framework Design