A Java-based UI test automation framework built with Selenium WebDriver, TestNG, and Maven, implementing the Page Object Model (POM) design pattern for maintainable end-to-end web testing.
- Page Object Model (POM): Clean separation between page interactions (
pageobjects), shared UI components (AbstractComponents), and test suites (tests). - Centralized, Secret-Safe Configuration:
ConfigReaderloadsGlobalData.properties, optionalconfig-<env>.propertiesoverlays (-Denv=qa|staging|prod),-Dsystem properties, andUPPER_SNAKE_CASEenvironment variable overrides, with${KEY}placeholder resolution inDataReader. - Thread-Safe Parallel Execution:
BaseTestmanagesWebDriverinstances viaThreadLocal<WebDriver>withdriver.quit()cleanup, paired withThreadLocal<ExtentTest>inListeners. - Flakiness Analytics & Auto-Quarantine:
FlakinessTrackerpersists per-test run counts, retries, failures, and durations toreports/flakiness-history.json, surfaces top flaky tests in ExtentReports, and auto-quarantines chronic offenders. - Data-Driven Testing: JSON test data parsing via Jackson (
DataReader+PurchaseOrder.json) integrated with TestNG@DataProvider. - TestNG Suite & Listener Architecture: Supports grouped execution (
Purchase,ErrorHandling), automatic retry (RetryimplementingIRetryAnalyzer), and automatic failure screenshots. - Rich Reporting & Logging: Generates HTML reports via ExtentReports (
reports/index.html) and structured logs via Log4j2 (logs/automation.log). - Containerized Execution:
Dockerfilebased onmaven:3.9-eclipse-temurin-21withgoogle-chrome-stablefor headless CI runs via Selenium Manager.
| Component | Technology / Version |
|---|---|
| Language | Java 21 |
| Build Tool | Apache Maven |
| Browser Automation | Selenium WebDriver 4.54.0 (with Selenium Manager) |
| Test Runner | TestNG 7.12.0 |
| Reporting | ExtentReports 5.1.2 |
| JSON Parsing | Jackson Databind 2.23.0 |
| File Utilities | Apache Commons IO 2.22.0 |
| Logging | Apache Log4j2 2.26.1 |
AdvancedAutomationFramework/
├── pom.xml # Maven dependencies and build configuration
├── Dockerfile # Maven JDK 21 + headless Chrome container
├── AGENTS.md # Repository guide for AI coding agents
├── reports/ # Generated ExtentReports HTML & failure screenshots
├── testSuites/
│ ├── testng.xml # Full regression suite (SubmitOrder + ErrorValidations)
│ ├── Purchase.xml # Purchase group suite
│ └── ErrorValidationTests.xml # ErrorHandling group suite
└── src/
├── main/java/org/miteshdandade/
│ ├── AbstractComponents/
│ │ └── AbstractComponent.java # Base page class (configurable waits, navigation)
│ ├── pageobjects/
│ │ ├── LandingPage.java # Login & landing page
│ │ ├── ProductCatalogue.java # Product listing & add-to-cart actions
│ │ ├── CartPage.java # Cart verification & checkout navigation
│ │ ├── CheckoutPage.java # Text-matched country selection & order submission
│ │ ├── ConfirmationPage.java # Order confirmation message
│ │ ├── OrderPage.java # Order history verification
│ │ └── ProductNotFoundException.java# Domain exception for missing catalogue items
│ └── resources/
│ ├── ConfigReader.java # Centralized properties/env/system-prop loader
│ ├── ExtentReporterNG.java # ExtentReports configuration
│ └── GlobalData.properties # Default browser, URL, and timeout settings
└── test/
├── java/org/miteshdandade/
│ ├── TestComponents/
│ │ ├── BaseTest.java # ThreadLocal WebDriver lifecycle, JSON data, screenshots
│ │ ├── FlakinessTracker.java # Persistent flakiness metrics & auto-quarantine
│ │ ├── Listeners.java # TestNG listener for ExtentReports, quarantine & screenshots
│ │ └── Retry.java # Configurable flaky test retry analyzer
│ ├── data/
│ │ ├── DataReader.java # Jackson JSON-to-Map reader
│ │ └── PurchaseOrder.json # Sample test data
│ ├── resources/
│ │ └── ExtentReporterNGTest.java
│ └── tests/
│ ├── SubmitOrderTest.java # End-to-end order & order history tests
│ ├── ErrorValidationsTest.java# Negative login & product validation tests
│ └── StandAloneTest.java # Standalone reference script
└── resources/
└── log4j2.xml # Log4j2 appenders (Console + logs/automation.log)
- JDK 21 installed and configured on
PATH(JAVA_HOMEset). - Apache Maven 3.8+ installed and configured on
PATH. - Google Chrome (default browser in
GlobalData.properties; drivers are managed automatically by Selenium Manager).
Defaults live in src/main/java/org/miteshdandade/resources/GlobalData.properties (env, browser, headless, baseUrl, explicitWaitSeconds, reportName, reportDocumentTitle, reportTester, maxRetryCount, quarantineEnabled, quarantineMinRuns, quarantineFailureRateThreshold). Override values via:
- Optional environment file:
config-<env>.properties(selected via-Denv=stagingorENV=staging) - Maven system properties:
-Dbrowser=chromeheadless,-DbaseUrl=https://...,-Dheadless=true - Environment variables:
BROWSER,HEADLESS,BASE_URL,EXPLICIT_WAIT_SECONDS,REPORT_TESTER,QUARANTINE_ENABLED - Test Credentials:
PurchaseOrder.jsonand test classes resolve credentials viaConfigReader/${ENV_VAR}placeholders. ProvideTEST_USER_EMAIL,TEST_USER_PASSWORD,SECONDARY_USER_EMAIL, andSECONDARY_USER_PASSWORD(via env vars or-Dproperties) before running tests.
Run the default Maven test lifecycle:
mvn testRun a specific TestNG suite:
mvn test -Dsurefire.suiteXmlFiles=testSuites/testng.xml
mvn test -Dsurefire.suiteXmlFiles=testSuites/Purchase.xml
mvn test -Dsurefire.suiteXmlFiles=testSuites/ErrorValidationTests.xmlOverride the target browser via system property:
mvn test -Dbrowser=chromeheadlessRun in Docker:
docker build -t advanced-automation-framework .
docker run --rm advanced-automation-framework- HTML Test Report:
reports/index.html - Flakiness History:
reports/flakiness-history.json - Failure Screenshots:
reports/<testMethodName>.png - Execution Logs:
logs/automation.log