Enterprise-grade test automation framework implementing Page Object Model (POM) design pattern with Behavior-Driven Development (BDD) using Cucumber, Selenium WebDriver, and TestNG. Features dual reporting mechanisms (Allure & Extent), Jenkins CI/CD integration, and cross-browser testing capabilities.
- Project Overview
- Key Features
- Technology Stack
- Project Architecture
- Prerequisites
- Installation & Setup
- Project Structure
- Configuration
- Running Tests
- Test Reports
- CI/CD Integration
- Test Coverage
- Best Practices
- Troubleshooting
- Contributing
- Documentation
- License
- Contact
Develop a robust, scalable, and maintainable end-to-end test automation solution that reduces manual testing effort by 95%, accelerates release cycles, and improves software quality with 85% functional coverage.
SauceDemo - E-commerce Web Application
https://www.saucedemo.com
- Execution Time: ~18 minutes (Full Regression Suite)
- Total Scenarios Active Scenarios
- Pass Rate: 94% (Consistent over 3 months)
- Flakiness Rate: 2% (Reduced from 12%)
- Time Savings: 95% reduction in regression testing time
- Defect Reduction: 45% decrease in production defects
- Page Object Model (POM) - Industry-standard design pattern for maintainability
- Behavior-Driven Development (BDD) - Cucumber with Gherkin syntax for business readability
- Dual Reporting - Allure Reports (technical) + Extent Reports (executive)
- Cross-Browser Testing - Chrome, Firefox, Edge with headless mode support
- Parallel Execution - ThreadSafe WebDriver management for concurrent test runs
- CI/CD Ready - Complete Jenkins pipeline integration with parameterized builds
- Smart Waits - Explicit wait strategies eliminating test flakiness
- Screenshot Capture - Automatic screenshot on failure with report integration
- Comprehensive Logging - Log4j2 with console and file appenders
- Data-Driven Testing - Externalized test data and configuration management
- Rerun Failed Tests - Automatic failed scenario retry mechanism
- Tag-Based Execution - Flexible test suite organization (@Smoke, @Regression, @E2E)
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Language | Java | 11 | Programming Language |
| Automation | Selenium WebDriver | 4.15.0 | Browser Automation |
| BDD Framework | Cucumber | 7.14.0 | Behavior-Driven Development |
| Test Framework | TestNG | 7.8.0 | Test Execution & Management |
| Build Tool | Maven | 3.9+ | Dependency & Build Management |
| Reporting | Allure Reports | 2.24.0 | Technical Test Reports |
| Reporting | Extent Reports | 5.1.1 | Executive Dashboard Reports |
| Driver Manager | WebDriverManager | 5.6.2 | Automatic Driver Management |
| Logging | Log4j2 | 2.20.0 | Application Logging |
| CI/CD | Jenkins | 2.x | Continuous Integration |
| Version Control | Git/GitHub | - | Source Code Management |
- AssertJ - Fluent assertions
- Apache POI - Excel file handling
- Commons IO - File utilities
- JSON Simple - JSON parsing
pages/
βββ BasePage.java β Common methods for all pages
βββ LoginPage.java β Login page elements & actions
βββ ProductsPage.java β Products page elements & actions
βββ CheckoutPage.java β Checkout page elements & actions
Benefits:
- Centralized element locators
- Reduced code duplication
- Easy maintenance
- Improved readability
- DriverManager implements singleton for WebDriver instance management
- Ensures single driver instance per thread
- Thread-safe WebDriver for parallel execution
- Isolated driver instances per test thread
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Test Layer (Feature Files) β
β Cucumber Scenarios (Gherkin) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step Definitions Layer (Glue Code) β
β Hooks, LoginSteps, ProductSteps, etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Page Object Layer (POM) β
β BasePage, LoginPage, ProductsPage, etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Utility Layer (Helpers) β
β DriverManager, WaitHelper, ConfigReader, etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Reporting & Logging Layer β
β Allure, Extent, Log4j2, Screenshots β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
| Software | Version | Download Link | Verification Command |
|---|---|---|---|
| Java JDK | 11+ | Oracle Java | java -version |
| Maven | 3.6+ | Apache Maven | mvn -version |
| Git | 2.x+ | Git SCM | git --version |
| Chrome | Latest | Google Chrome | - |
| IntelliJ IDEA | 2023.x+ | JetBrains | - |
Windows:
JAVA_HOME = C:\Program Files\Java\jdk-11
MAVEN_HOME = C:\Program Files\Apache\maven
PATH = %JAVA_HOME%\bin;%MAVEN_HOME%\binMac/Linux:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
export MAVEN_HOME=/usr/local/apache-maven
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATHgit clone https://github.com/krishnaharshap/selenium-cucumber-framework.git
cd selenium-cucumber-frameworkmvn clean install -DskipTestsExpected Output:
[INFO] BUILD SUCCESS
[INFO] Total time: 2.345 s
mvn clean compileEdit src/main/resources/config/config.properties:
# Browser Configuration
browser=chrome
headless=false
# Application URL
url=https://www.saucedemo.com/
# Wait Times
implicit.wait=10
explicit.wait=20mvn clean test "-Dcucumber.filter.tags=@Smoke"selenium-cucumber-framework/
β
βββ src/
β βββ main/
β β βββ java/com/automation/
β β β βββ pages/ # Page Object Classes
β β β β βββ BasePage.java
β β β β βββ LoginPage.java
β β β β βββ ProductsPage.java
β β β β βββ CheckoutPage.java
β β β β
β β β βββ utils/ # Utility Classes
β β β β βββ DriverManager.java
β β β β βββ ConfigReader.java
β β β β βββ WaitHelper.java
β β β β βββ ScreenshotUtil.java
β β β β βββ ExcelReader.java
β β β β
β β β βββ constants/ # Framework Constants
β β β βββ FrameworkConstants.java
β β β
β β βββ resources/
β β βββ config/
β β β βββ config.properties # Application Config
β β βββ log4j2.xml # Logging Config
β β
β βββ test/
β βββ java/com/automation/
β β βββ stepdefinitions/ # Cucumber Step Definitions
β β β βββ Hooks.java
β β β βββ LoginSteps.java
β β β βββ ProductSteps.java
β β β βββ CheckoutSteps.java
β β β
β β βββ runners/ # Test Runners
β β β βββ TestRunner.java
β β β βββ FailedTestRunner.java
β β β
β β βββ listeners/ # TestNG Listeners
β β βββ ExtentReportListener.java
β β βββ AllureListener.java
β β
β βββ resources/
β βββ features/ # Cucumber Feature Files
β β βββ Login.feature
β β βββ ProductPurchase.feature
β β βββ E2ECheckout.feature
β β
β βββ extent.properties # Extent Config
β βββ extent-config.xml
β βββ allure.properties # Allure Config
β
βββ test-output/ # Test Execution Results
β βββ extent-reports/ # Extent HTML Reports
β βββ allure-results/ # Allure Results
β βββ cucumber-reports/ # Cucumber Reports
β βββ screenshots/ # Failure Screenshots
β
βββ logs/ # Application Logs
β βββ automation.log
β
βββ pom.xml # Maven Configuration
βββ testng.xml # TestNG Suite
βββ Jenkinsfile # CI/CD Pipeline
βββ .gitignore # Git Ignore Rules
β
βββ Documentation/ # Project Documentation
βββ INTERVIEW_GUIDE.md
βββ SETUP_INSTRUCTIONS.md
βββ PROJECT_SUMMARY.md
βββ QUICK_REFERENCE.md
File: src/main/resources/config/config.properties
# Browser Settings
browser=chrome # Options: chrome, firefox, edge
headless=false # true for headless execution
# Application URL
url=https://www.saucedemo.com/
# Timeouts (seconds)
implicit.wait=10
explicit.wait=20
page.load.timeout=30
# Test Credentials
valid.username=standard_user
valid.password=secret_sauce
# Reporting
take.screenshot.on.failure=trueFile: testng.xml
<suite name="E2E Test Automation Suite" parallel="none">
<test name="Regression Tests">
<classes>
<class name="com.automation.runners.TestRunner"/>
</classes>
</test>
</suite>File: pom.xml
Key dependencies managed:
- Selenium WebDriver 4.15.0
- Cucumber 7.14.0
- TestNG 7.8.0
- Allure 2.24.0
- Extent Reports 5.1.1
mvn clean test# Smoke Tests (5-7 minutes)
mvn clean test -Dcucumber.filter.tags="@Smoke"
# Regression Tests (15-20 minutes)
mvn clean test -Dcucumber.filter.tags="@Regression"
# E2E Tests (10-12 minutes)
mvn clean test -Dcucumber.filter.tags="@E2E"
# Login Module Only
mvn clean test -Dcucumber.filter.tags="@Login"mvn clean test -Dbrowser=chrome
mvn clean test -Dbrowser=firefox
mvn clean test -Dbrowser=edgemvn clean test -Dheadless=truemvn clean test -Dcucumber.features="src/test/resources/features/Login.feature"mvn clean test -Dcucumber.filter.tags="@Smoke" -Dbrowser=chrome -Dheadless=true- Navigate to
TestRunner.java - Right-click β Run 'TestRunner'
- Open any
.featurefile - Click green play button next to scenario
- Select "Run Scenario"
- Right-click on
testng.xml - Select "Run testng.xml"
| Strategy | Tag | Implementation | Use Case |
|---|---|---|---|
| Smoke | @Smoke |
3 scenarios | Quick validation |
| Regression | @Regression |
16 scenarios | Full validation |
| E2E | @E2E |
5 scenarios | End-to-end flows |
| Critical | @Critical |
2 scenarios | Business-critical tests |
| Positive | @Positive |
Happy paths | Success scenarios |
| Negative | @Negative |
Error handling | Validation scenarios |
| Module | @Login, @Product |
Module-specific | Targeted testing |
| Dryrun | @Dryrun |
Pre-execution | Validation checks |
# Generate and serve report (opens in browser)
mvn allure:serve
# Generate report only
mvn allure:reportReport Location: target/site/allure-maven-plugin/index.html
- Interactive HTML dashboard
- Test execution trends and history
- Step-by-step execution breakdown
- Screenshot attachments
- Timeline and duration metrics
- Categorization by severity and features
- Environment information
Report Location: test-output/extent-reports/ExtentReport_[timestamp].html
- Executive summary dashboard
- Pass/Fail statistics with charts
- Pie charts and visual representations
- Detailed error logs
- Embedded screenshots
- System information
- Customizable themes
Report Location: test-output/cucumber-reports/cucumber.html
- Scenario-wise execution details
- Step-level pass/fail status
- Execution duration
- Feature-wise grouping
| Feature | Allure | Extent | Cucumber |
|---|---|---|---|
| Visual Dashboard | β | ||
| Historical Trends | β | β | |
| Screenshots | |||
| Step Details | |||
| Charts/Graphs | β | ||
| Executive Summary | β |
File: Jenkinsfile
- Checkout - Clone repository from SCM
- Clean - Remove previous build artifacts
- Compile - Compile source code
- Run Tests - Execute test suite with parameters
- Generate Reports - Create Allure and Extent reports
- Post Actions - Publish reports and send notifications
| Parameter | Type | Options | Description |
|---|---|---|---|
| BROWSER | Choice | chrome, firefox, edge | Browser for execution |
| TAGS | Choice | @Smoke, @Regression, @E2E | Test tags to execute |
| HEADLESS | Boolean | true, false | Headless mode toggle |
pipeline {
agent any
parameters {
choice(name: 'BROWSER', choices: ['chrome', 'firefox', 'edge'])
choice(name: 'TAGS', choices: ['@Smoke', '@Regression', '@E2E'])
booleanParam(name: 'HEADLESS', defaultValue: false)
}
stages {
stage('Run Tests') {
steps {
bat "mvn clean test -Dbrowser=${BROWSER} -Dcucumber.filter.tags=${TAGS}"
}
}
}
}- Allure Reports published via Allure Jenkins Plugin
- Extent Reports published via HTML Publisher Plugin
- Cucumber Reports archived as build artifacts
- Success emails with report links
- Failure emails with console output
- Configurable recipient list
triggers {
cron('H 2 * * 1-5') // Nightly at 2 AM, weekdays
}- Valid login with standard user
- Invalid username validation
- Invalid password validation
- Locked user handling
- Step-by-step login flow
- Data-driven login scenarios
- Add single product to cart
- Add multiple products to cart
- Remove product from cart
- View cart with products
- Product count validation
- Complete E2E purchase flow
- Single item checkout
- Multi-user checkout validation
| Metric | Value |
|---|---|
| Total Scenarios | Active Scenarios |
| View live test runs | GitHub Actions Workflow |
| Recent changes | Commit History |
| Development activity | Network Graph |
| Automated vs Manual | 70:30 |
- Follow SOLID principles
- Implement DRY (Don't Repeat Yourself)
- Use meaningful variable and method names
- Add comments for complex logic
- Maintain consistent code formatting
- Write independent test scenarios
- Use appropriate wait strategies
- Avoid hard-coded values
- Implement proper exception handling
- Keep tests atomic and focused
- Regular dependency updates
- Code review for all changes
- Refactor duplicate code
- Update documentation
- Monitor test flakiness
// Page Objects
public class LoginPage extends BasePage {}
// Step Definitions
@Given("user is on the login page")
public void userIsOnTheLoginPage() {}
// Feature Files
Feature: User Login Functionality
Scenario: Successful login with valid credentials# Solution
mvn dependency:purge-local-repository
mvn clean install -U# Verify internet connection
# WebDriverManager downloads drivers automatically
# Check Maven logs for download issues# Increase wait times in config.properties
explicit.wait=30
implicit.wait=15# Install Cucumber plugin in IDE
# Mark src/test/resources as Test Resources Root
# Rebuild project: Build β Rebuild Project# Clean and regenerate
mvn clean test
mvn allure:report# Change Jenkins port
java -jar jenkins.war --httpPort=9090# Run tests in debug mode with detailed logs
mvn clean test -X -Dcucumber.filter.tags="@Smoke"<!-- Adjust in log4j2.xml -->
<Root level="debug"> <!-- Change to: info, warn, error -->
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</Root>- Fork the Repository
- Create Feature Branch
git checkout -b feature/new-test-scenario
- Make Changes
- Follow coding standards
- Add appropriate tests
- Update documentation
- Commit Changes
git commit -m "feat: add login with Google scenario" - Push to Branch
git push origin feature/new-test-scenario
- Create Pull Request
- Provide detailed description
- Link related issues
- Request code review
feat: Add new feature
fix: Fix bug
docs: Update documentation
test: Add or update tests
refactor: Code refactoring
style: Code formatting
chore: Maintenance tasks
- Code follows project conventions
- Tests pass locally
- Documentation updated
- No sensitive data committed
- Proper error handling
- Logging implemented
| Document | Description | Location |
|---|---|---|
| README.md | Project overview and setup | Root |
| SETUP_INSTRUCTIONS.md | Detailed setup instructions | Root |
| PROJECT_SUMMARY.md | Executive summary | Root |
| QUICK_REFERENCE.md | Command reference | Root |
- Selenium Documentation
- Cucumber Documentation
- TestNG Documentation
- Allure Documentation
- Maven Documentation
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Krishna Harsha
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Krishna Harsha
Email: krishnaharshap11@gmail.com
LinkedIn: linkedin.com/in/krishnap
GitHub: github.com/krishnaharshap
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Email: krishnaharshap11@gmail.com
- SauceDemo for providing the test application
- Selenium Community for excellent documentation and support
- Cucumber Team for the BDD framework
- Allure & Extent teams for reporting solutions
- Open Source Community for continuous improvements
Help us build together β see community metrics & learn how to contribute:
π Community Graph & Contribution Guide
- API Testing Integration (RestAssured)
- Mobile Testing (Appium)
- Visual Regression Testing (Applitools)
- Performance Testing (JMeter)
- Database Validation (JDBC)
- Docker Containerization
- Kubernetes Deployment
- AI-Based Self-Healing Locators
If you find this project useful, please consider giving it a star!
Made with passion for Test Automation
Last Updated: February 2026
Latest Changes: View Commit History
Version 1.0-SNAPSHOT
Status Active Development
Last Commit ef39a16
Java Support 11+