This project is a test automation framework using Selenium WebDriver, Cucumber (BDD), Java, and Gherkin syntax.
- Java JDK 11 or higher
- Maven 3.6+
- IDE (IntelliJ IDEA, Eclipse, or VS Code recommended)
- Chrome, Firefox, or Edge browser installed
SCM/
├── pom.xml # Maven configuration file
├── README.md # Project documentation
└── src/
└── test/
├── java/
│ └── com/
│ └── scm/
│ ├── runners/
│ │ └── RunCucumberTest.java # Test runner class
│ ├── steps/
│ │ ├── Hooks.java # Before/After hooks
│ │ ├── GoogleSearchSteps.java # Step definitions for Google search
│ │ └── ErmishoeLoginSteps.java # Step definitions for Ermishoe login
│ └── utils/
│ └── DriverManager.java # WebDriver management utility
└── resources/
└── features/
├── google_search.feature # Google search feature file
└── ermishoe_login.feature # Ermishoe login feature file
Maven will automatically download all dependencies when you build the project.
mvn clean installRun the tests to verify everything is set up correctly:
mvn testOr run tests with a specific tag:
mvn test -Dcucumber.filter.tags="@smoke"mvn test# Run only smoke tests
mvn test -Dcucumber.filter.tags="@smoke"
# Run only regression tests
mvn test -Dcucumber.filter.tags="@regression"
# Run both smoke and regression
mvn test -Dcucumber.filter.tags="@smoke or @regression"# Run with Chrome (default)
mvn test -Dbrowser=chrome
# Run with Firefox
mvn test -Dbrowser=firefox
# Run with Edge
mvn test -Dbrowser=edge- PowerShell (Windows) requires quoting
-Dproperties and prefers classpath paths:
.\mvnw.cmd test "-Dcucumber.features=classpath:features/ermishoe_login.feature" "-Dbrowser=chrome"- macOS/Linux:
./mvnw test -Dcucumber.features=classpath:features/google_search.feature -Dbrowser=chrome- To run all tests (runner discovers features on classpath):
.\mvnw.cmd testFeature files use Gherkin syntax and are located in src/test/resources/features/.
Example:
Feature: Google Search
As a user
I want to search on Google
So that I can find information on the internet
@smoke
Scenario: Search for a term on Google
Given I am on the Google homepage
When I search for "Selenium WebDriver"
Then I should see search results containing "Selenium"Step definitions are Java classes in src/test/java/com/scm/steps/ that implement the Gherkin steps.
Example:
@Given("I am on the Google homepage")
public void i_am_on_the_google_homepage() {
driver.get("https://www.google.com");
}After running tests, multiple comprehensive reports are generated in target/cucumber-reports/:
- HTML Report:
cucumber-html-report.html- Interactive report with screenshots, logs, and detailed results - Timeline Report:
timeline/timeline.html- Visual timeline showing execution flow - JSON Report:
cucumber.json- Machine-readable format for CI/CD integration - JUnit XML:
cucumber.xml- Standard XML format for build tools - Usage Report:
cucumber-usage.json- Performance metrics and step execution times - Rerun File:
rerun.txt- List of failed scenarios for easy rerunning - Report Index:
index.html- Central hub to access all reports
- View all reports: Open
target/cucumber-reports/index.htmlin your browser - Main HTML report: Open
target/cucumber-reports/cucumber-html-report.html - Timeline visualization: Open
target/cucumber-reports/timeline/timeline.html
- ✅ Automatic screenshot capture on test failures
- ✅ Detailed scenario logs with timestamps
- ✅ Browser information tracking
- ✅ Performance metrics and execution times
- ✅ Visual timeline for parallel execution
- ✅ Failed test rerun file generation
📖 For detailed information about reports, see REPORTS.md
Manages WebDriver instances and supports multiple browsers (Chrome, Firefox, Edge). Automatically handles driver setup using WebDriverManager.
Contains @Before and @After hooks that:
- Initialize the WebDriver before each scenario
- Log scenario start time and browser information
- Take screenshots on test failure with timestamped names
- Log scenario completion time and status
- Clean up the WebDriver after each scenario
RunCucumberTest.java is the JUnit test runner that executes Cucumber scenarios.
Set the browser using system property:
-Dbrowser=chromeSupported browsers: chrome, firefox, edge
To run tests in headless mode, uncomment the headless options in DriverManager.java:
chromeOptions.addArguments("--headless");- Selenium WebDriver 4.15.0 - Browser automation
- Cucumber 7.14.0 - BDD testing framework
- JUnit 5.10.0 - Test execution framework
- WebDriverManager 5.6.2 - Automatic driver management
WebDriverManager should automatically download the correct driver. If you encounter issues:
- Make sure you have internet connectivity
- Check that your browser is up to date
- Manually specify driver path if needed
- Check that the target website is accessible
- Verify that selectors match the current page structure
- Check screenshots in the report for visual debugging
- Add more feature files for your application
- Create page object model classes for better organization
- Integrate with CI/CD pipelines
- Add data-driven testing with Cucumber data tables
- Configure parallel test execution