⬡ Hub
Skip to content

bdd-cucumber

BDD Cucumber Framework

This framework implements Behavior-Driven Development (BDD) using Cucumber for writing and executing automated tests. It allows defining test scenarios in a human-readable format (Gherkin) and linking them to step definitions written in Java.

Project Structure

  • src/test/resources/features: Contains .feature files written in Gherkin syntax, describing the test scenarios.
  • src/test/java/com/example/runners: Contains TestRunner classes for executing feature files. Includes runners for local, Grid, Sauce Labs, and BrowserStack execution.
  • src/test/java/com/example/stepdefinitions: Contains Java classes with step definitions that implement the steps defined in the feature files.

How to Run Tests

Local Execution

To run tests locally using Maven, navigate to the bdd-cucumber directory and execute:

mvn test

This will execute tests using the TestRunner.java.

Selenium Grid Execution

To run tests on a Selenium Grid, ensure your Grid is up and running, then execute:

mvn test -Dcucumber.filter.tags="@Grid"

This will execute tests tagged with @Grid using GridTestRunner.java.

Sauce Labs Execution

To run tests on Sauce Labs, you need to set your Sauce Labs username and access key as environment variables (SAUCE_USERNAME and SAUCE_ACCESS_KEY). Then execute:

mvn test -Dcucumber.filter.tags="@SauceLabs"

This will execute tests tagged with @SauceLabs using SauceLabsTestRunner.java.

BrowserStack Execution

To run tests on BrowserStack, you need to set your BrowserStack username and access key as environment variables (BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY). Then execute:

mvn test -Dcucumber.filter.tags="@BrowserStack"

This will execute tests tagged with @BrowserStack using BrowserStackTestRunner.java.

Jenkins Integration

This framework includes a Jenkinsfile for continuous integration. It defines stages for building the project and running tests.

Docker Integration

This framework also includes a Jenkinsfile_docker and Dockerfile to build and run tests within a Docker container, ensuring a consistent test environment.

Files and Subdirectories