- Introduction
- Features
- Applications Under Test
- Database Used
- Reporting
- Installation
- Configuration
- Usage
- Parallel Testing
- Folder Structure
- Dependencies
- Contributing
- License
- Contact
The cucumber-jdbc-ui-db-test-lab framework combines Cucumber for BDD, Selenium for UI testing, JDBC for database interactions, and TestNG for test execution. This robust automation solution is designed to facilitate thorough testing of both front-end and back-end aspects, with support for cross-browser compatibility and detailed reporting.
- Behavior-Driven Development (BDD) with Cucumber and Gherkin syntax for easy-to-read test scenarios.
- UI Automation using Selenium WebDriver, supporting Chrome, Firefox, Edge, and Safari browsers.
- Database Testing through JDBC, allowing direct interactions with the database.
- Apache POI Integration for reading and writing Excel files as test data sources.
- Detailed Reporting in HTML and PDF formats using Extent Reports, with screenshots for failed scenarios.
- Parallel Execution to expedite test runs across multiple threads.
- Page Object Model (POM) structure for better maintainability and readability.
- Jenkins CI/CD Integration for automated build and test pipelines.
This framework is designed to test two applications:
- Mersys Application: A comprehensive application that requires thorough UI and back-end testing.
- ZeroBank Application: An online banking platform used to simulate scenarios such as login, payee management, and foreign currency purchase.
This project uses the Sakila MySQL sample database for educational and testing purposes. It enables realistic database testing scenarios within the framework.
- HTML and PDF Reports: Generated using Extent Reports and located in
test-output
andtestReports
. - ScenarioResults.xlsx: Captures the result of each test scenario, including the status and browser used. Managed through the
Hooks
class.
Example ScenarioResults.xlsx
:
Scenario Name | Status | Browser |
---|---|---|
Login Test | Passed | Chrome |
Search Test | Failed | Firefox |
Checkout Test | Passed | Edge |
-
Clone the repository:
git clone https://github.com/cihat-kose/cucumber-jdbc-ui-db-test-lab.git
-
Open in IntelliJ IDEA:
- File > New > Project from Version Control
- Enter the repository URL and click Clone.
-
Ensure necessary plugins are installed:
- Cucumber for Java and Gherkin plugins for IntelliJ IDEA.
-
Wait for Maven dependencies to be downloaded and project setup to complete.
-
Database and Browser Configuration:
- Update
cucumber.properties
with the database URL, username, password, and default browser:browser=chrome dbUrl=jdbc:mysql://localhost:3306/sakila dbUser=root dbPassword=password
- Update
-
Extent Report Configuration:
- Customize
extent.properties
for report and screenshot paths:reportPath=test-output/extent-report.html screenshotPath=test-output/screenshots/
- Customize
-
Running Tests:
- In IntelliJ IDEA, navigate to
src/test/java
. - Right-click any test file or directory and select
Run 'TestName'
.
- In IntelliJ IDEA, navigate to
-
Jenkins Integration:
- Set up a Jenkins job to automatically build and test the project. Steps:
- Add a Maven project with
clean test
goals. - Configure source code management to link to this repository.
- Add post-build actions to publish the HTML reports generated by Extent Reports.
- Add a Maven project with
- Set up a Jenkins job to automatically build and test the project. Steps:
To run tests in parallel, configure the ParallelTest.xml
or use your own TestNG XML files with parallel attributes. This will allow concurrent execution of multiple test cases, speeding up the test suite.
cucumber-jdbc-ui-db-test-lab/
│
├── src/
│ ├── main/
│ └── test/
│ ├── java/
│ │ ├── apachePOI/ # Excel handling with Apache POI
│ │ ├── features/ # Cucumber feature files
│ │ ├── jdbc/ # JDBC related code
│ │ ├── pages/ # Page Object Model (POM) classes
│ │ ├── runners/ # TestNG runner classes
│ │ ├── stepDefinitions/ # Cucumber step definitions
│ │ ├── utilities/ # Utility classes
│ │ └── xml/ # TestNG XML configurations
│ └── resources/
│ ├── cucumber.properties # Cucumber configurations
│ └── extent.properties # Extent report configurations
│
├── pom.xml # Maven configuration file
└── README.md # Project README file
Essential dependencies in pom.xml
include:
- Selenium WebDriver for browser automation.
- Cucumber for BDD using Gherkin syntax.
- TestNG for test execution and parallel testing.
- Apache POI for reading and writing Excel files.
- MySQL Connector for database connectivity with JDBC.
- Extent Reports for detailed reporting.
- Java Faker for generating test data dynamically.
We welcome contributions! To contribute:
- Fork this repository.
- Create a feature branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add feature'
). - Push to the branch (
git push origin feature-branch
). - Create a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or issues, please open an issue in this repository.