An open API service indexing awesome lists of open source software.

https://github.com/otakmager/seleniumpomdatadriven

Data-driven test automation framework using Selenium WebDriver, TestNG, and Apache POI. Tests various unit conversions from an online converter using a clean Page Object Model (POM) architecture, dynamic Excel data providers, structured logging, and ExtentReports.
https://github.com/otakmager/seleniumpomdatadriven

automated-testing data-driven-tests java page-object-model qa-automation selenium selenium-java selenium-webdriver testng

Last synced: about 1 month ago
JSON representation

Data-driven test automation framework using Selenium WebDriver, TestNG, and Apache POI. Tests various unit conversions from an online converter using a clean Page Object Model (POM) architecture, dynamic Excel data providers, structured logging, and ExtentReports.

Awesome Lists containing this project

README

          

# ๐Ÿ“Š SeleniumPomDataDriven

This project implements **data-driven test automation** for unit conversions using [https://www.digitaldutch.com/unitconverter/](https://www.digitaldutch.com/unitconverter/) as the system under test. The project uses **Selenium WebDriver** in Java with the **Page Object Model (POM)** architecture and integrates **TestNG** and **Excel-based Data Providers** to cover dynamic testing scenarios across various measurement units.

> โœ… Live base URL: [https://www.digitaldutch.com/unitconverter/length.htm](https://www.digitaldutch.com/unitconverter/length.htm)
> ๐Ÿ“ฆ GitHub Repo: [https://github.com/otakmager/SeleniumPomDataDriven](https://github.com/otakmager/SeleniumPomDataDriven)

---

## ๐Ÿงฑ Project Structure

```
SeleniumPomDataDriven/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ main/
โ”‚ โ”‚ โ””โ”€โ”€ java/
โ”‚ โ”‚ โ”œโ”€โ”€ base/ # BaseTest & core setup
โ”‚ โ”‚ โ”œโ”€โ”€ pageObjects/ # Page Objects
โ”‚ โ”‚ โ”œโ”€โ”€ pageEvents/ # Page Events (logic layer)
โ”‚ โ”‚ โ”œโ”€โ”€ keyword # Action & validation Keywords
โ”‚ โ”‚ โ””โ”€โ”€ utils/ # ExcelUtils, ReportManager, Constants
โ”‚ โ”œโ”€โ”€ test/
โ”‚ โ”‚ โ””โ”€โ”€ java/
โ”‚ โ”‚ โ””โ”€โ”€ testCases/
โ”‚ โ”‚ โ”œโ”€โ”€ LengthConverterTest.java
โ”‚ โ”‚ โ”œโ”€โ”€ MassConverterTest.java
โ”‚ โ”‚ โ”œโ”€โ”€ TimeConverterTest.java
โ”‚ โ”‚ โ””โ”€โ”€ UserInterfaceTest.java
โ”‚ โ””โ”€โ”€ resources/
โ”‚ โ””โ”€โ”€ datasets.xlsx # Test data for each converter sheet
โ”œโ”€โ”€ logs/
โ”‚ โ””โ”€โ”€ app.log # Test log
โ”œโ”€โ”€ reports/ # HTML reports generated via ExtentReports
โ”œโ”€โ”€ screenshots/ # Failure screenshots (auto-captured)
โ”œโ”€โ”€ testng.xml # Master suite file
โ””โ”€โ”€ README.md
```

---

## โœ… Features

- ๐Ÿ’ก **POM (Page Object Model)** based design for maintainability and reuse
- ๐Ÿงช **Data-Driven Testing** using `.xlsx` files via Apache POI
- ๐Ÿงพ **HTML Reports** using ExtentReports
- ๐Ÿ“ธ **Screenshot on Failure**
- โš™๏ธ **Logger Integration** with `log4j2` for test activity traceability

---

## ๐Ÿš€ How to Run

### 1. Clone the Repository
```bash
git clone https://github.com/otakmager/SeleniumPomDataDriven.git
```

### 2. Open in IntelliJ IDEA
- Requires: **IntelliJ IDEA Community Edition 2024.3.5**
- Uses: **Java JDK 17**
- Built-in: **TestNG plugin** (no external Maven setup required)

### 3. Run All Tests
- Right-click `testng.xml` โ†’ **Run 'testng.xml'**
- HTML report will be created in the `/reports/` folder

---

## ๐Ÿ“ฆ Test Coverage

Each test class corresponds to a category of unit conversion or interaction:

| Test Class | Description | Sheet in Excel |
|---------------------------|----------------------------------|----------------------|
| [`LengthConverterTest`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/src/test/java/testCases/length/LengthConverterTest.java) | Convert between length units | `length` |
| [`MassConverterTest`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/src/test/java/testCases/mass/MassConverterTest.java) | Convert between mass units | `mass` |
| [`TimeConverterTest`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/src/test/java/testCases/time/TimeConverterTest.java) | Convert between time units | `time` |
| [`UserInterfaceTest`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/src/test/java/testCases/ui/UserInterfaceTest.java) | Basic smoke tests for UI access | *(no data source)* |

---

## ๐Ÿ“Š Test Data Source

All test inputs are stored in [`src/test/resources/datasets.xlsx`](https://github.com/otakmager/SeleniumPomDataDriven/raw/refs/heads/main/src/test/resources/datasets.xlsx) with dedicated sheets per category.

Each sheet has the format:
```
Value1 | fromUnit | Value2 | toUnit
------------------------------------------------------------
12.5 | kilometers [km] | 12500 | meters [m]
...
```

The `ExcelUtils` dynamically reads rows and feeds them into tests via `@DataProvider`.

---

## ๐Ÿ“œ Logs & Reports

- โœ… Logs written to: [`logs/app.log`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/logs/app.log)
- โœ… HTML test report: [`reports/test-report.html`](https://github.com/otakmager/SeleniumPomDataDriven/blob/main/reports/test-report.html)
- โœ… Screenshots on failure: [`screenshots/`](https://github.com/otakmager/SeleniumPomDataDriven/tree/main/screenshots)

Log includes detailed info such as:
- Test start markers per method
- Excel data loading feedback
- Element interaction and assertion steps

---

## ๐Ÿ”ง Technologies Used

- Java 17
- Selenium WebDriver
- TestNG
- Apache POI (Excel reading)
- ExtentReports
- log4j2
- WebDriverManager
- IntelliJ IDEA CE 2024.3.5

---