- 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.
- Datafaker Library for generating realistic test data.
- 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, configured via the Maven Surefire plugin.
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 saved under
test-output/
andtestReports/
. Generated reports are excluded from version control, so run the test suite to create fresh reports and open them in your browser. - 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.
-
Extent Report Configuration:
- Customize
extent.properties
for report and screenshot paths:reportPath=test-output/extent-report.html screenshotPath=test-output/screenshots/
- Customize
-
Browser Selection:
- The default browser is set in
GWD
. You can override it by setting thebrowser
system property:mvn test -Dbrowser=chrome
- The default browser is set in
-
Database Credentials:
- JDBC tests read connection details from environment variables. Set these variables before running the tests or the default demo values will be used:
export DB_URL=jdbc:mysql://demo.mersys.io:33906/sakila export DB_USER=admin export DB_PASSWORD=Techno24Study.%=
- JDBC tests read connection details from environment variables. Set these variables before running the tests or the default demo values will be used:
-
Running Tests:
- In IntelliJ IDEA, navigate to
src/test/java
. - Right-click any test file or directory and select
Run 'TestName'
. - Or execute all tests from the command line:
mvn clean test
- 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
- The
pom.xml
contains a Maven Surefire configuration that specifies which test runners Jenkins will execute.
- 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/
β βββ 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/
β βββ 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.
- Datafaker 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.