Sample Selenium automation framework built with Java, Maven, TestNG, Page Object Model, ExtentReports, and JSON-based test data.
This repository is a learning/demo project, not a production-ready automation framework. It shows the basic structure and flow of a UI test framework for an ecommerce application hosted at https://rahulshettyacademy.com/client.
- Java 17
- Maven
- Selenium 4
- TestNG
- ExtentReports
- Jackson Databind
- Cucumber dependencies included
- Browser setup through a common base test
- Page Object Model with reusable page classes
- TestNG test organization and suite XML files
- Data-driven tests using JSON
- Retry logic for unstable tests
- ExtentReports integration through TestNG listeners
src/main/java
AbstractComponent/
PageObjects/
src/test/java
Cucumber/
Data/
Resources/
StepDefinisions/
Testcomponents/
Testing/
TestSuite/
reports/
Testcomponents.BaseTest: driver setup, app launch, JSON reader, screenshot captureAbstractComponent.AbstractComponents: common waits and top navigation actionsPageObjects.*: page object classes for login, product catalog, cart, checkout, and ordersTestcomponents.Listeners: TestNG listener for ExtentReports and failure screenshotsTesting.SubmitOrder: data-driven happy path purchase flowTesting.Errorvalidation: invalid login validationTesting.SmokeTest: simple navigation smoke flow
- Java 17 installed
- Maven installed and available on
PATH - Chrome or Edge installed locally
- Internet access to reach the demo application
Browser selection is read from:
src/test/java/Resources/GlobalData.properties
Current value:
browser="chrome"The framework also allows overriding the browser through a JVM system property:
mvn test -Dbrowser=chromeFor headless execution, the code expects values such as chromeheadless or edgeheadless.
Purchase test data is stored in:
src/test/java/Data/PurchaseData.json
The SubmitOrder test reads this JSON and executes against multiple data sets.
Run the default Maven test phase:
mvn testRun the TestNG regression-style suite configured in Maven profile Regression:
mvn test -PRegressionRun the purchase-focused suite:
mvn test -PPurchaseRun the smoke suite:
mvn test -PSmokeTestRun with a browser override:
mvn test -PRegression -Dbrowser=chromeAfter execution, reports are generated under:
reports/report.htmltest-output/target/surefire-reports/