This project is a sample automation framework for an e-commerce platform, built using Java, Selenium WebDriver, Cucumber BDD, and integrated with reporting tools. It allows you to execute end-to-end tests and generate rich reports for better insights.
- Project Overview
- Core Libraries and Tools
- Folder Structure
- How To Run The Tests
- Report Generation
- Contributing
- Contact
This framework automates user flows for an e-commerce platform and is designed for scalability, maintainability, and integration with CI/CD pipelines. It leverages Cucumber for BDD (Behavior-Driven Development), allowing business-readable tests and supports robust reporting for test results.
- Java 11: Programming language for automation code.
- Selenium WebDriver: Browser automation.
- Cucumber: BDD framework for writing feature files in Gherkin.
cucumber-javacucumber-junitcucumber-picocontainer
- WebDriverManager: Automatic browser driver management.
- JUnit 4: Test runner and assertions.
- SLF4J, Logback: Logging.
- cucumber-reporting (Masterthought): Advanced test report generation.
- Maven: Build automation and dependency management.
selenium-java-cucumber/
├── pom.xml # Maven configuration and dependencies
├── README.md # Project documentation
├── RunTestsOnMac.sh # Shell script to run tests on macOS
├── RunTestsOnWindows.cmd # Windows batch script to run tests
└── src
├── main
│ └── java
│ └── pages/ # Page Object Model classes for UI abstraction
└── test
├── java/ # Step Definitions and Test Runners
└── resources/ # Feature files and test data
pom.xml: Configures dependencies like Selenium, Cucumber, JUnit, reporting plugins, and build plugins.src/main/java/pages: Contains Java classes modeling different application pages and actions (Page Objects).src/test/java: Houses step definitions and test runner classes.src/test/resources: All feature files written in Gherkin syntax, as well as test configuration and data files.
- Java 11+
- Maven 3.6+
- Git
- Clone this repository:
git clone <repository-url> cd selenium-java-cucumber
- Install dependencies:
mvn clean compile
You can use Maven directly:
mvn clean testOr use the provided scripts:
- Windows:
RunTestsOnWindows.cmd
- macOS/Linux:
chmod +x RunTestsOnMac.sh ./RunTestsOnMac.sh
TestRunner:
Maven Surefire Plugin is configured to automatically detect and execute any class with the pattern *Runner.java as a test suite.
Test Filtering:
You may use Cucumber tags for selective test execution by configuring Maven's cucumber.filter.tags property.
- Cucumber automatically generates basic HTML and JSON reports in
target/cucumber-reports/.
- A comprehensive, customizable HTML report is generated after test execution via the
maven-cucumber-reportingplugin. - After running tests, the report can be found at:
target/cucumber-reports/cucumber-html-reports/overview-features.html
- The
maven-cucumber-reportingplugin processes thecucumber.jsonproduced by Cucumber. - Configuration options (such as output and input directories, project name, and classifications) are present in the
pom.xml.
- Feature overview
- Step breakdown
- Tags
- Error stack traces for failures
- Trends over multiple runs (if applicable)

Contributions are welcome! Please fork the repository, create a feature branch, commit your changes, and open a Pull Request.
For questions or issues, please create an issue in the repository or reach out to the project maintainer.