A BDD (Behavior-Driven Development) test automation framework for Practice Software Testing ToolShop e-commerce website testing using Selenium WebDriver, Cucumber, and Java with TestNG integration.
- Overview
- Features
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running Tests
- Test Scenarios
- Author
This framework demonstrates test automation practices for testing ToolShop e-commerce website. Built with BDD methodology, it provides comprehensive test coverage for authentication, product management, checkout processes, and end-to-end user journeys.
automation-framework/ ├── src/ │ ├── main/ │ │ └── java/ │ │ ├── driver/ │ │ │ └── DriverFactory.java # WebDriver management │ │ ├── pageObjects/ │ │ │ ├── Base_PO.java # Base page object with utilities │ │ │ ├── Auth_PO.java # Authentication pages │ │ │ ├── Product_PO.java # Product listing & filtering │ │ │ └── EndToEnd_PO.java # Checkout & transaction flow │ │ ├── properties/ │ │ │ └── config.properties # Configuration file │ │ └── utils/ │ │ └── Global_Vars.java # Global constants & test data │ └── test/ │ ├── java/ │ │ ├── runners/ │ │ │ ├── MainRunner.java # Main Runner │ │ │ └── testng/ │ │ │ └── testng.xml # TestNG configuration │ │ └── stepDefinitions/ │ │ ├── base/ │ │ │ └── Hooks.java # Before/After hooks │ │ ├── Auth_Steps.java # Authentication step definitions │ │ ├── ProductPage_Steps.java # Product page step definitions │ │ └── EndToEnd_Steps.java # E2E transaction step definitions │ └── resources/ │ └── features/ │ ├── Auth.feature # Authentication scenarios │ ├── ProductPage.feature # Product page scenarios │ ├── Checkout.feature # Checkout scenarios │ └── EndToEnd.feature # E2E transaction scenarios ├── pom.xml # Maven dependencies ├── .gitignore └── README.md
git clone https://github.com/saisyah101/Selenium-Cucumber-Java.git cd Selenium-Cucumber-Java/automation-framework
mvn clean installCreate or edit src/main/java/properties/config.properties:
browser=chrome headless=false
Edit config.properties or use system properties:
# Run with Chrome mvn test -DbrowserType=chrome
# Run with Firefox mvn test -DbrowserType=firefox
# Run in headless mode mvn test -Dheadless=true
Configure in testng.xml:
<suite name="Suite1" parallel="classes" data-provider-thread-count="3">
Enable/disable in Hooks.java:
private static final boolean ENABLE_VIDEO_RECORDING = false;
mvn clean test
mvn test -Dcucumber.filter.tags="@auth"
# Authentication tests mvn test -Dcucumber.filter.tags="@auth"
# Product page tests mvn test -Dcucumber.filter.tags="@productpage"
# End-to-end tests mvn test -Dcucumber.filter.tags="@E2E"
# Guest user tests mvn test -Dcucumber.filter.tags="@guest"
# Authenticated user tests mvn test -Dcucumber.filter.tags="@authenticated"
# Specific scenario mvn test -Dcucumber.filter.tags="@user-transaction"
# Chrome mvn test -DbrowserType=chrome
# Firefox mvn test -DbrowserType=firefox
# Headless Chrome mvn test -DbrowserType=chrome -Dheadless=true
Siti Aisyah
LinkedIn