https://github.com/sandipchopkar95/java_selenium_junit-bdd_demoblaze
This is a Behavior Driven Development (BDD) test automation framework using Selenium WebDriver, Java, JUnit, and Cucumber. It follows Page Object Model (POM) design principles and is structured for scalable and maintainable test automation.
https://github.com/sandipchopkar95/java_selenium_junit-bdd_demoblaze
bdd cucumber cucumber-java java selenium
Last synced: 28 days ago
JSON representation
This is a Behavior Driven Development (BDD) test automation framework using Selenium WebDriver, Java, JUnit, and Cucumber. It follows Page Object Model (POM) design principles and is structured for scalable and maintainable test automation.
- Host: GitHub
- URL: https://github.com/sandipchopkar95/java_selenium_junit-bdd_demoblaze
- Owner: sandipchopkar95
- Created: 2024-12-11T17:12:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-14T12:14:03.000Z (about 1 year ago)
- Last Synced: 2025-05-14T13:36:05.612Z (about 1 year ago)
- Topics: bdd, cucumber, cucumber-java, java, selenium
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java Selenium BDD Framework with JUnit
This is a Behavior Driven Development (BDD) test automation framework using **Selenium WebDriver**, **Java**, **JUnit**, and **Cucumber**. It follows **Page Object Model (POM)** design principles and is structured for scalable and maintainable test automation.
---
## ๐ Project Structure
```
src/
โโโ main/
โ โโโ java/com/personal/demoblaze/
โ โโโ AppConstants/ # Application constants
โ โ โโโ AppConstant.java
โ โโโ config/ # Driver and config setup
โ โ โโโ ConfigReader.java
โ โ โโโ DriverManager.java
โ โโโ pages/ # Page Object Model classes
โ โ โโโ CartPage.java
โ โ โโโ ContactUs.java
โ โ โโโ HomePage.java
โ โ โโโ LoginPage.java
โ โ โโโ MyAccountPage.java
โ โโโ utils/ # Utility classes
โ โโโ ScreenshotUtil.java
โ โโโ WaitHelper.java
โ
โโโ test/
โ โโโ java/com/personal/demoblaze/
โ โโโ basetest/ # Base test class
โ โ โโโ BaseTest.java
โ โโโ runners/ # Cucumber test runners
โ โ โโโ TestRunner.java
โ โโโ stepdefinitions/ # Step definition classes
โ โโโ HomePage_Steps.java
โ โโโ Login_Logout_Steps.java
โ โโโ MyAccountPage_Steps.java
โ
โโโ resources/
โ โโโ config.properties # Test configuration
โ โโโ features/homepage/ # Feature files
โ โโโ HomePage.feature
โ โโโ Login_LogOut.feature
โ โโโ MyAccountPage.feature
โ โโโ cucumber.properties
```
---
## ๐ Getting Started
### Prerequisites
- Java JDK 11+
- Maven 3.6+
- IDE (IntelliJ IDEA, Eclipse, etc.)
- Browser driver (e.g., ChromeDriver)
### Installation
Clone the repository and navigate to the project root directory.
```bash
git clone https://github.com/your-repo/demoblaze-bdd-framework.git
cd demoblaze-bdd-framework
```
Install dependencies:
```bash
mvn clean install
```
---
## ๐งช Running Tests
Run the test suite using Maven:
```bash
mvn test
```
Or directly run via JUnit in your IDE using `TestRunner.java`.
---
## ๐งพ Writing Feature Files
Feature files are written in **Gherkin** syntax and located in `src/test/resources/features/homepage/`.
Example:
```gherkin
Feature: Login Functionality
Scenario: Successful login with valid credentials
Given user is on login page
When user enters valid username and password
Then user should be redirected to the homepage
```
---
## ๐งฉ Step Definitions
Step definitions are implemented in `stepdefinitions/` and mapped to feature file steps using Cucumber annotations:
```java
@Given("user is on login page")
public void user_is_on_login_page() {
loginPage.navigateToLogin();
}
```
---
## โ Configuration
Edit `config.properties` to change environment settings such as:
```properties
browser=chrome
baseUrl=https://demoblaze.com
implicitWait=10
```
---
## ๐ธ Utilities
- `ScreenshotUtil.java`: Captures screenshots on failures.
- `WaitHelper.java`: Provides custom wait logic.
---
## ๐งฑ Base Test
`BaseTest.java` handles browser setup and teardown using JUnit `@Before` and `@After`.
---
## ๐ Reporting
Integrate tools like **ExtentReports**, **Allure**, or **Cucumber Reports** for advanced reporting (not included in base setup).
---