Skip to content

A robust automation framework combining Cucumber, Selenium, JDBC, and TestNG for comprehensive UI and database testing. Features BDD, parallel testing, CI/CD integration, and detailed reporting.

License

Notifications You must be signed in to change notification settings

cihat-kose/cucumber-jdbc-ui-db-test-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cucumber JDBC UI DB Test Lab

Cucumber Selenium TestNG JDBC Maven Java Jenkins Apache POI

πŸ“‹ Table of Contents

  1. Introduction
  2. Features
  3. Applications Under Test
  4. Database Used
  5. Reporting
  6. Installation
  7. Configuration
  8. Usage
  9. Parallel Testing
  10. Folder Structure
  11. Dependencies
  12. Contributing
  13. License
  14. Contact

πŸ’‘ Introduction

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.

✨ Features

  • 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.

🌐 Applications Under Test

This framework is designed to test two applications:

  1. Mersys Application: A comprehensive application that requires thorough UI and back-end testing.
  2. ZeroBank Application: An online banking platform used to simulate scenarios such as login, payee management, and foreign currency purchase.

πŸ’Ύ Database Used

This project uses the Sakila MySQL sample database for educational and testing purposes. It enables realistic database testing scenarios within the framework.

πŸ“ Reporting

  • HTML and PDF Reports: Generated using Extent Reports and saved under test-output/ and testReports/. 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

πŸ“₯ Installation

  1. Clone the repository:

    git clone https://github.com/cihat-kose/cucumber-jdbc-ui-db-test-lab.git
  2. Open in IntelliJ IDEA:

    • File > New > Project from Version Control
    • Enter the repository URL and click Clone.
  3. Ensure necessary plugins are installed:

    • Cucumber for Java and Gherkin plugins for IntelliJ IDEA.
  4. Wait for Maven dependencies to be downloaded and project setup to complete.

πŸ”§ Configuration

  1. Extent Report Configuration:

    • Customize extent.properties for report and screenshot paths:
      reportPath=test-output/extent-report.html
      screenshotPath=test-output/screenshots/
  2. Browser Selection:

    • The default browser is set in GWD. You can override it by setting the browser system property:
      mvn test -Dbrowser=chrome
  3. 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.%=

βš™οΈ Usage

  1. 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
  2. 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.
    • The pom.xml contains a Maven Surefire configuration that specifies which test runners Jenkins will execute.

⚑ Parallel Testing

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.

πŸ“‚ Folder Structure

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

πŸ“¦ Dependencies

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.

🀝 Contributing

We welcome contributions! To contribute:

  1. Fork this repository.
  2. Create a feature branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a Pull Request.

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Contact

For questions or issues, please open an issue in this repository.


About

A robust automation framework combining Cucumber, Selenium, JDBC, and TestNG for comprehensive UI and database testing. Features BDD, parallel testing, CI/CD integration, and detailed reporting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published