A scalable UI test automation framework for the Automation Exercise e-commerce application, automating smoke & E2E scenarios.
The project is built with Java, Selenium WebDriver, TestNG, Maven, Page Object Model (POM), data-driven testing, Extent Reports, Log4j2, retry handling, screenshots, parallel execution, and GitHub Actions CI.
The current repository focuses on a Smoke Test Suite covering the application's most important customer journeys.
- Page Object Model design
- Reusable
BasePagefor common page-object functionality - Reusable
BaseTestfor test setup, teardown, and WebDriver management - Reusable header and footer components
- Separating page logic, reusable components, test logic, configuration, and test data
- Writing TestNG smoke and end-to-end tests
- Cross-browser WebDriver setup
- Chrome, Firefox, and Edge support
- Supporting headed and headless browser execution
- Thread-safe WebDriver using
ThreadLocal - Parallel TestNG execution
- Smoke test grouping
- JSON-based data-driven test data
- Environment-variable-based credentials
- TestNG listeners
- Automatic screenshots for failed tests
- Generating ExtentReports HTML reports
- Capturing severe browser-console JavaScript errors during failures
- Logging execution information with Log4j2
- Retrying selected failed tests with a TestNG retry analyzer
- Executing smoke tests through Maven profiles
- Running automated tests in GitHub Actions CI
- CI artifact upload for reports, Surefire results, and logs.
Automation Exercise
https://automationexercise.com
Default configuration:
baseUrl=https://automationexercise.com
browser=chrome
headless=false
implicitWait=10
explicitWait=10Note:
smoke.xmlcurrently passeschromeas the browser parameter, so the smoke suite runs on Chrome unless that TestNG parameter is changed.
| Technology | Usage |
|---|---|
| Java 25 | Programming language |
| Selenium WebDriver 4.48.0 | Browser automation |
| TestNG 7.12.0 | Test execution and assertions |
| Maven | Build and dependency management |
| WebDriverManager 6.3.4 | Browser driver management |
| Extent Reports 5.1.2 | HTML test reporting |
| Log4j2 | Logging |
| Jackson Databind | JSON test-data handling |
| GitHub Actions | Continuous Integration |
Ecommerce_AutomationFrameWork_Smoke/
│
├── .github/
│ └── workflows/
│ └── test.yml
│
├── reports/
│ └── screenshots/
│
├── logs/
│
├── src/
│ ├── main/
│ │ └── java/
│ │ ├── base/
│ │ │ └── BasePage.java
│ │ │
│ │ ├── components/
│ │ │ ├── FooterComponent.java
│ │ │ └── HeaderComponent.java
│ │ │
│ │ ├── constants/
│ │ │ └── Routes.java
│ │ │
│ │ ├── pages/
│ │ │ ├── CartPage.java
│ │ │ ├── CategoryPage.java
│ │ │ ├── CheckoutPage.java
│ │ │ ├── HomePage.java
│ │ │ ├── LoginPage.java
│ │ │ ├── OrderConfirmationPage.java
│ │ │ ├── PaymentPage.java
│ │ │ ├── ProductListPage.java
│ │ │ ├── ProductDetailsPage.java
│ │ │ ├── RegistrationPage.java
│ │ │ ├── SearchResultsPage.java
│ │ │ └── SuccessRegisterPage.java
│ │ │
│ │ └── utils/
│ │ ├── ConfigReader.java
│ │ ├── Credentials.java
│ │ ├── JsonDataReader.java
│ │ └── ScreenshotUtils.java
│ │
│ └── test/
│ ├── java/
│ │ ├── base/
│ │ │ └── BaseTest.java
│ │ │
│ │ ├── dataproviders/
│ │ │ └── TestDataProvider.java
│ │ │
│ │ ├── listeners/
│ │ │ └── TestListener.java
│ │ │
│ │ ├── reporting/
│ │ │ └── ExtentReportManager.java
│ │ │
│ │ ├── retry/
│ │ │ └── RetryAnalyzer.java
│ │ │
│ │ └── tests/
│ │ ├── auth/
│ │ │ ├── LoginTests.java
│ │ │ ├── LogoutTests.java
│ │ │ └── RegistrationTests.java
│ │ │
│ │ ├── cart/
│ │ │ ├── AddToCartTests.java
│ │ │ └── CartTests.java
│ │ │
│ │ ├── checkout/
│ │ │ ├── CheckoutTests.java
│ │ │ ├── ShippingTests.java
│ │ │ └── PaymentTests.java
│ │ │
│ │ ├── e2e/
│ │ │ └── PurchaseFlowE2eTest.java
│ │ │
│ │ ├── home/
│ │ │ └── HomepageTests.java
│ │ │
│ │ └── products/
│ │ ├── ProductListingTests.java
│ │ ├── ProductDetailsTests.java
│ │ └── ProductSearchTests.java
│ │
│ └── resources/
│ ├── testdata/
│ │ ├── checkout.json
│ │ ├── invalidLogins.json
│ │ ├── paymentDetails.json
│ │ ├── validRegistration.json
│ │ ├── products.json
│ │ └── searchData.json
│ │
│ ├── config.properties
│ └── log4j2.xml
│
├── pom.xml
└── smoke.xml
The project contains smoke coverage across the main e-commerce workflows.
- User registration
- Login
- Logout
Test classes:
LoginTests.java
LogoutTests.java
RegistrationTests.java
- Critical home-page functionality
Test class:
HomepageTests.java
- Product listing
- Product details
- Product search
Test classes:
ProductListingTests.java
ProductDetailsTests.java
ProductSearchTests.java
- Add product to cart
- Verify product quantity in cart
- Verify cart total price
- Remove product from cart
Test classes:
AddToCartTests.java
CartTests.java
- Checkout flow
- Shipping
- Payment
Test classes:
CheckoutTests.java
ShippingTests.java
PaymentTests.java
- e-commerce purchase flow from login to order completion
Test class:
PurchaseFlowE2eTest.java
Install the following before running the project locally:
- JDK 25
- Maven
- A supported browser:
- Google Chrome
- Mozilla Firefox
- Microsoft Edge
- Git
WebDriver binaries do not need to be configured manually because the framework uses WebDriverManager.
Verify the installation:
java -version
mvn -version
git --versiongit clone https://github.com/ahmdyosry/Ecommerce_AutomationFrameWork_Smoke.git
cd Ecommerce_AutomationFrameWork_SmokeSome tests require an existing Automation Exercise account.
The framework reads credentials from environment variables rather than storing them directly in the source code:
TEST_EMAIL
TEST_PASSWORD
$env:TEST_EMAIL="your-test-email@example.com"
$env:TEST_PASSWORD="your-test-password"set TEST_EMAIL=your-test-email@example.com
set TEST_PASSWORD=your-test-passwordexport TEST_EMAIL="your-test-email@example.com"
export TEST_PASSWORD="your-test-password"Do not commit real credentials to the repository.
Run the smoke Maven profile:
mvn clean test -PsmokeThe smoke profile executes:
smoke.xml
The suite includes tests tagged with:
groups = "smoke" & groups = "cartState"mvn clean test -Psmoke -Dheadless=trueThis is the same execution mode used by the GitHub Actions workflow.
When headless mode is enabled, the browser window is configured to:
1920 x 1080
BaseTest supports:
chrome
firefox
edge
The browser selection priority is:
TestNG XML browser parameter
↓
-DcliBrowser system property
↓
config.properties
The current smoke.xml contains:
<parameter name="browser" value="chrome"/>Therefore, the smoke suite currently executes with Chrome.
To run the smoke suite using Firefox or Edge, update the browser parameter in smoke.xml.
Example:
<parameter name="browser" value="firefox"/>or:
<parameter name="browser" value="edge"/>The smoke suite is configured for parallel execution with TestNG.
<suite name="smokesuite" parallel="tests" thread-count="4">The "smoke tests" test block also enables method-level parallelism:
<test name="smoke tests" parallel="methods" thread-count="2">The framework protects each test thread with its own WebDriver instance using:
ThreadLocal<WebDriver>This prevents browser instances from being shared between parallel tests.
Test data is stored separately from the test logic under:
src/test/resources/testdata/
Examples include:
checkout.json
invalidLogins.json
paymentDetails.json
validRegistration.json
products.json
searchData.json
JSON files are read through the framework's data utilities and TestNG data providers.
This keeps test data separate from test implementation and makes scenarios easier to maintain.
Framework configuration is stored in:
src/test/resources/config.properties
Current properties:
baseUrl=https://automationexercise.com
browser=chrome
headless=false
implicitWait=10
explicitWait=10The headless value can also be overridden from Maven:
-Dheadless=trueThe framework uses Extent Reports for execution reporting.
Generated reports are stored under:
reports/
After a GitHub Actions execution, the report is uploaded as the artifact:
extent-report
Screenshot utilities are included in the framework to capture browser state during execution and failure handling.
Screenshots are stored under:
reports/screenshots/
The project uses Log4j2.
Configuration:
src/test/resources/log4j2.xml
Log output is stored under:
logs/
In GitHub Actions, logs are uploaded as:
automation-logs
Failed-test retry support is implemented through:
retry/RetryAnalyzer.java
This allows selected failed tests to be re-executed according to the configured retry policy.
A retry mechanism should be used carefully: it can reduce noise from temporary browser or network instability, but it should not be used to hide consistently failing or flaky tests.
CI configuration:
.github/workflows/test.yml
The workflow is triggered by:
- Pushes to the
mainbranch - Manual execution using
workflow_dispatch
The CI pipeline:
- Checks out the repository
- Sets up Temurin JDK 25
- Uses Maven dependency caching
- Reads
TEST_EMAILandTEST_PASSWORDfrom GitHub Secrets - Executes the smoke suite in headless mode
- Uploads Extent Reports
- Uploads Maven Surefire reports
- Uploads Log4j2 logs
CI test command:
mvn clean test -Psmoke -Dheadless=true -DtrimStackTrace=false -eAdd these repository secrets:
TEST_EMAIL
TEST_PASSWORD
GitHub path:
Repository
→ Settings
→ Secrets and variables
→ Actions
→ New repository secret
The workflow uploads the following artifacts even if tests fail:
| Artifact | Path |
|---|---|
extent-report |
reports/ |
surefire-reports |
target/surefire-reports/ |
automation-logs |
logs/ |
This makes test failures easier to investigate directly from a GitHub Actions run.
The framework separates responsibilities into several layers:
Tests
↓
Page Objects
↓
Reusable Components
↓
Base Page / Selenium Utilities
↓
WebDriver
Supporting layers handle:
Configuration
Test Data
Credentials
Listeners
Screenshots
Reporting
Logging
Retry Logic
This structure improves maintainability and reduces duplicated Selenium code as the test suite grows.
A typical e-commerce test follows this pattern:
Launch browser
↓
Open Automation Exercise
↓
Navigate using Page Objects
↓
Perform user actions
↓
Validate expected behavior
↓
Listener records test result
↓
Capture evidence when required
↓
Update Extent Report
↓
Close browser
The pom.xml define this execution profile:
smoke
The smoke profile points to:
smoke.xml
Run it with:
mvn clean test -Psmoke- Selenium WebDriver
- TestNG annotations and assertions
- Page Object Model (POM)
- Reusable page components
- Base test and base page abstractions
- Explicit waits
- Browser configuration
- Headless execution
- Cross-browser driver setup
- WebDriverManager
- ThreadLocal WebDriver
- Selenium ThreadGuard
- Parallel test execution
- TestNG groups
- TestNG DataProviders
- JSON-based data-driven testing
- Environment variables
- GitHub Secrets
- Test listeners
- ExtentReports
- Failure screenshots
- Browser-console error capture
- Log4j2
- Retry analyzer
- Maven profiles
- GitHub Actions CI
- CI artifact publishing
- End-to-end test automation
Ahmed Yosry
GitHub: @ahmdyosry
https://github.com/ahmdyosry/Ecommerce_AutomationFrameWork_Smoke