GitHub Repository: https://github.com/dinesh776/IdentifyCarWashes.git
A Java automation framework that validates core user journeys on Justdial and extracts service details. It supports local and Selenium Grid execution, BDD-style test definitions with Cucumber, TestNG orchestration with retries, data-driven testing via Excel, JSON exports, and rich reporting with Allure, ExtentReports, and Cucumber HTML.
- Java 21
- Maven
- Selenium 4
- Cucumber JVM 7 (Gherkin BDD)
- TestNG
- Allure Reports + ExtentReports + Cucumber HTML report
- Apache POI (Excel)
- Log4j2
- JSON-simple
IdentifyServices/
├─ pom.xml
├─ testng.xml
├─ src/
│ ├─ main/
│ │ ├─ java/
│ │ │ ├─ base/ # BasePage and common selenium wait/JS helpers
│ │ │ ├─ model/ # Domain models (e.g., Service)
│ │ │ └─ pages/ # Page Objects (HomePage, ServicePage, ResultsPage, FreeListingPage)
│ │ │
│ │ │ └─ utilities/ # ConfigReader, ExcelUtility, JsonUtility, ReportOpener, ScreenshotUtility
│ │ └─ resources/
│ │ ├─ config.properties # App/config settings (env, waits, Allure path, etc.)
│ │ └─ log4j2.xml
│ └─ test/
│ ├─ java/
│ │ ├─ hooks/ # WebDriver lifecycle, screenshots, Allure attachments
│ │ ├─ stepDefinitions/ # Step definitions per feature
│ │ ├─ testRunner/ # Cucumber TestNG runner
│ │ └─ reRun/ # TestNG retry listener/analyzer
│ └─ resources/
│ ├─ features/ # Gherkin feature files
│ ├─ extent.properties
│ └─ allure.properties
├─ selenium_grid/ # Convenience scripts to run Grid hub/node/standalone (Windows .bat)
├─ testdata/ # Excel test data (referenced in config)
├─ output/ # JSON export target
├─ Report/ # Extent report output (also mirrored under test-output/*)
└─ target/ # Build + Allure/Cucumber outputs
- Page Object Model with explicit waits and safe JS interactions
- Local and Remote (Selenium Grid) execution
- Cucumber BDD with Gherkin features and TestNG runner
- Retry of failed tests (once) via TestNG listeners
- Data-driven test flows from Excel
- Structured JSON result export
- Automatic report generation and opening:
- Allure (requires Allure CLI)
- Extent Spark HTML
- Cucumber HTML
- Screenshots on failure attached to Allure and Cucumber reports
- JDK 21
- Maven 3.8+
- Google Chrome or Microsoft Edge installed
- Allure Commandline (to auto-open Allure report from the suite):
- Install Allure CLI and note the
allure.batpath on Windows - Set
allure.bat.pathinsrc/main/resources/config.properties
- Install Allure CLI and note the
- Optional: Selenium Grid (if running
environment=remote)
Selenium 4 includes Selenium Manager which can provision drivers automatically when using new ChromeDriver()/new EdgeDriver().
Edit src/main/resources/config.properties:
environment=localorremoteremote.url= Grid hub URL (e.g.,http://localhost:4444)app.url= AUT base URL (default:https://justdial.com)implicit.wait= seconds for implicit waitexplicit.wait= seconds for WebDriverWaittest.data.file= path to Excel test data (e.g.,testdata/test_data.xlsx)test.data.sheet.name= sheet name (e.g.,ServiceData)total.number.of.services= number of result cards to evaluateexpected.votes= minimum votes threshold when filtering result cardsjson.file.path= JSON export path (e.g.,output/result.json)allure.bat.path= absolute path toallure.bat
Edit TestNG parameters in testng.xml (applies to local and remote):
<parameter name="browser" value="chrome|edge"/><parameter name="platform" value="windows|linux|mac"/>
mvn clean test
This triggers the TestNG suite, which invokes the Cucumber runner in testRunner.TestRunner.
By default, the runner points features to:
src/test/resources/features/category_display.feature
To run all features or filter by tags, edit src/test/java/testRunner/TestRunner.java:
- Set
features = {"src/test/resources/features"}to run all - Optionally enable tags:
tags = "@sanity or @regression"
- Right-click
testng.xmland run - Or run the
TestRunnerclass directly
- Set
environment=remoteinconfig.properties - Set
remote.urlto the Grid hub (e.g.,http://<hub-host>:4444) - Start Grid (Windows sample
.batscripts inselenium_grid/):hub.bat(hub)node.bat(node) — ensure it points to your hub URLstandalone.bat(single node)
- Then run
mvn clean test
category_display.feature: View All Categories shows expected countsearch_functionality.feature: Search with valid/invalid inputs and page navigationfilter_functionality.feature: Apply rating filters and validate resultsshow_number_popup.feature: Validate Show Number popup reveals contactservice_page_query.feature: Submit query with valid/invalid inputs and OTP/error handlingexcel_reading.feature: Data-driven run from Excel; retrieves services and saves to JSONretrieve_items.feature: Retrieve items above a vote threshold and log count
- Excel location and sheet configured via
config.properties - Expected columns used by step definitions:
LocationService NameQuick Filters(e.g.,Top Rated,Quick Response,Jd Verified,Jd Trust, ornone)Sort By(e.g.,Relevance,Rating,Popular, ornone)Ratings(e.g.,Any,3.5+,4.0+,4.5+,5ornone)
- During
excel_reading.featurewith@SaveJson, services are collected and written to a JSON array per service name - Output path:
output/result.json(configurable)
Reports are generated automatically and opened after the suite (Windows) by utilities.ReportOpener:
- Allure:
target/allure-results→target/allure-report(requiresallure.bat.path) - Extent Spark:
test-output/JustDailReport <timestamp>/Report/CucumberExtentReport.html - Cucumber HTML:
target/cucumber-report.html
Manual Allure commands (if you prefer CLI):
allure generate target/allure-results --clean -o target/allure-report
allure open target/allure-report
- Log4j2 for framework logs (
src/main/resources/log4j2.xml) - Screenshots captured on step failure and attached to Allure and Cucumber outputs
- A failed test is retried once via
reRun.RetryListenerandreRun.RetryAnalyzer
- Allure not opening: verify
allure.bat.pathinconfig.propertiesand that Allure CLI is installed - Grid connection errors: confirm
remote.urlis reachable (default hubhttp://localhost:4444) - Popups blocking actions: popups are handled in step backgrounds; ensure the AUT UI hasn’t changed
- Element timing: adjust
implicit.wait/explicit.waitinconfig.properties - Feature selection: update
featuresandtagsinTestRunner.javato run desired scenarios