https://github.com/omarelsheikh1/cucumber-todo-testing-framework
BDD testing framework for a Todo app using Cucumber and Selenium WebDriver. Supports Chrome, Firefox, and Edge with a clean Page Object Model. Integrates TestNG for parallel test runs, uses simple config files for different environments, and automates user login and task creation.
https://github.com/omarelsheikh1/cucumber-todo-testing-framework
cucumber feature-test java maven selenium testng-framework
Last synced: about 1 month ago
JSON representation
BDD testing framework for a Todo app using Cucumber and Selenium WebDriver. Supports Chrome, Firefox, and Edge with a clean Page Object Model. Integrates TestNG for parallel test runs, uses simple config files for different environments, and automates user login and task creation.
- Host: GitHub
- URL: https://github.com/omarelsheikh1/cucumber-todo-testing-framework
- Owner: OmarElsheikh1
- Created: 2025-07-06T11:06:01.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-07-07T14:58:43.000Z (11 months ago)
- Last Synced: 2025-07-07T15:53:11.954Z (11 months ago)
- Topics: cucumber, feature-test, java, maven, selenium, testng-framework
- Language: Java
- Homepage: https://todo.qacart.com
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฅ Cucumber Todo Testing Framework
[](https://docs.oracle.com/en/java/javase/21/)
[](https://www.selenium.dev/documentation/)
[](https://cucumber.io/docs)
[](https://testng.org/)
A robust UI automation framework for the [QACart Todo App](https://todo.qacart.com) using Java, Selenium WebDriver, Cucumber, and TestNG. Follows the Page Object Model (POM), supports multi-browser execution, and is optimized for maintainability and CI/CD pipelines.
---
## โจ Key Features
- โ
**BDD Approach**: Gherkin scenarios for business-readable tests
- ๐ **Cross-Browser**: Chrome/Firefox/Edge support
- โ๏ธ **Environment Configs**: Local/Staging/Production setups
- ๐งต **Thread-Safe**: Parallel execution ready
- ๐ **CI/CD**: GitHub Actions integration
- ๐ **Logging**: Detailed execution logs
---
## ๐งฉ Project Structure
```bash
๐ src/test
โโโ ๐ java
โ โโโ ๐ com.qacart.todo
โ โโโ ๐ base # Core WebDriver setup
โ โโโ ๐ factory # Browser instantiation
โ โโโ ๐ hooks # Test lifecycle management
โ โโโ ๐ pages # POM classes (LoginPage, TodoPage)
โ โโโ ๐ runners # TestNG cucumber runners
โ โโโ ๐ steps # Gherkin step implementations
โ โโโ ๐ utils # Config helpers
โโโ ๐ resources
โโโ ๐ features # Business scenarios
โโโ ๐ properties # Environment configs
```
## โก Quick Start
### โ
Prerequisites
- Java 21+
- Maven 3.8+
### โถ๏ธ Run Tests
```bash
# Default: Chrome + STAGING
mvn clean test
# Custom environment and browser
mvn test -Dbrowser=firefox -Denv=PRODUCTION
```
---
## ๐ง Configuration
### 1. Environment Setup
Edit properties in:
```text
src/test/resources/properties/
โโโ local.properties
โโโ staging.properties
โโโ production.properties
```
### 2. Browser Management
Supported browsers via `-Dbrowser` flag:
```bash
chrome | firefox | edge
```
---
## ๐งช Sample Test
Feature File `(user.feature)`:
```gherkin
Feature: User Features
Scenario: User should be able to login
Given User is at the login page
When User fill the email and password and login
Then Welcome message should be displayed
```
Step Definition:
``` java
@Given("User is at the login page")
public void userIsAtTheLoginPage() throws IOException {
// Initialize the WebDriver using the DriverFactory
driver = DriverFactory.getDriver();
// Navigate to the login page of the application
new LoginPage(driver).load(EnvUtils.getInstance().getUrl() + "/login");
}
@When("User fill the email and password and login")
public void userFillTheEmailAndPassword() throws IOException {
// Log in to the application by using the LoginPage class
new LoginPage(driver).login(EnvUtils.getInstance().getEmail(), EnvUtils.getInstance().getPassword());
}
@Then("Welcome message should be displayed")
public void welcomeMessageShouldBeDisplayed() {
// Verify that the welcome message is displayed after login
boolean isWelcomeDisplayed = new TodoPage(driver).isWelcomeMessageDisplayed();
Assert.assertTrue(isWelcomeDisplayed, "Welcome message is not displayed");
}
```
---
## ๐ฆ CI/CD Pipeline
Runs on push to `master` branch (`.github/workflows/test.yml`):
```yaml
on:
push:
branches: ["main"]
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '21'
- uses: browser-actions/setup-chrome@latest
- run: mvn clean test
```
---
## ๐ Reporting & Logging
- HTML Reports: target/cucumber-reports/
- Logs: logs/ via Log4j2
``` properties
# Sample log output
[DEBUG] Initializing ChromeDriver...
[INFO] Loading PRODUCTION environment
```
---
## ๐ก Best Practices
1. Page Object Model (POM): Each page = single class
2. Environment abstraction via EnvUtils
3. Reusable steps: Modular, easy to maintain
4. Parallel execution with ThreadLocal WebDriver
---
## ๐ License
Distributed under the MIT License. See the LICENSE file for more details.