Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A comprehensive test automation framework for UI and database testing using Cucumber, Selenium, JDBC, and TestNG. Includes cross-browser support, parameterized testing, and detailed reporting with ExtentReports.

License

NotificationsYou must be signed in to change notification settings

cihat-kose/cucumber-jdbc-ui-db-learning-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CucumberSeleniumTestNGJDBCMavenJavaJenkinsApache POI

Table of Contents

  1. Introduction
  2. Why Use This Framework?
  3. Key Benefits
  4. Application Under Test
  5. Database Used
  6. Reporting
  7. Features
  8. Prerequisites
  9. Installation
  10. Usage
  11. Parallel Testing
  12. Folder Structure
  13. Dependencies
  14. Contributing
  15. License
  16. Contact

Introduction

The Cucumber JDBC UI DB Learning Path is an automated testing solution designed for seamless integration of UI and database (DB) testing using Cucumber, Selenium, JDBC, and TestNG. This framework supports cross-browser testing and generatesdetailed reports.

Why Use This Framework?

In modern software development, ensuring the quality of both the user interface and the backend database is crucial.Manual testing can be time-consuming and prone to errors. This framework offers a robust solution by combining thestrengths of Cucumber for behavior-driven development (BDD), Selenium for UI testing, JDBC for database interactions,and TestNG for test execution and reporting.

Key Benefits

  • Seamless Integration: Easily integrate UI and DB tests in a single framework.
  • Behavior-Driven Development: Use Gherkin syntax to define test scenarios in a human-readable format.
  • Cross-Browser Support: Test your application across multiple browsers to ensure compatibility.
  • Detailed Reporting: Generate comprehensive test reports to quickly identify and fix issues. Reports are producedin both HTML and PDF formats and may include screenshots.
  • Parameterized Testing: Use data tables for running tests with multiple sets of data.
  • Easy Configuration: Simple configuration for different environments and databases.
  • Apache POI Integration: Read and write Excel files using Apache POI.
  • Jenkins Integration: The framework can be easily integrated into Jenkins for continuous integration/delivery (CI/CD) processes.
  • Page Object Model (POM): Improve test maintenance and readability by using the Page Object Model design pattern.

Application Under Test

This framework is currently used to test theMersys application. Mersys is a comprehensivesolution that requires thorough testing to ensure its reliability and performance.

Database Used

This framework uses theSakila database for database testing. Sakila is anexample database commonly used for educational and testing purposes.

Reporting

Test results are stored in thetest-output andtestReports directories. Test reports are generated in both HTML (Spark) and PDF formats using ExtentReports and may include screenshots.Additionally, test scenario results are recorded in theScenarioResults.xlsxfile. This file is located in thesrc/test/java/apachePOI/resource directory.

TheScenarioResults.xlsx file provides a mini-report for each test scenario, including the scenario name, status (passed/failed), and the browser used. This is done using theHooks class in the framework.

ExampleScenarioResults.xlsx content:

Scenario NameStatusBrowser
Login TestPassedChrome
Search TestFailedFirefox
Checkout TestPassedEdge
Sample Report Screenshot

Features

  • Scenario Outline: Define test scenarios using Gherkin syntax for behavior-driven development (BDD).
  • Data Table: Use data tables for parameterized testing with multiple data sets.
  • Runner Class: Execute tests using the TestNG runner class.
  • Reports: Generate detailed test reports in HTML and PDF formats, including screenshots.
  • Cross-Browser Support: Ensure compatibility by testing your application across multiple browsers.
  • Apache POI: Read and write Excel files for test data management.
  • JDBC: Perform database operations using JDBC.
  • Jenkins Integration: Easily integrate with Jenkins for continuous integration and delivery (CI/CD) processes.
  • Page Object Model (POM): Improve test maintenance and readability by using the Page Object Model design pattern.

Prerequisites

  • Java 21 or higher
  • Maven 3.8+
  • Git for version control management
  • IntelliJ IDEA (or a similar IDE) with Cucumber and Gherkin plugins installed
  • Chrome,Firefox, orEdge along with the appropriate WebDriver binaries
  • Jenkins for CI/CD pipelines (optional)

Installation

  1. Clone the repository:

  2. Install necessary plugins:

    • In order to work with Cucumber and Gherkin in IntelliJ IDEA, ensure you have the following plugins installed:

      • Cucumber for Java (by JetBrains)
      • Gherkin (by JetBrains)
    • To install these plugins:

      1. Open IntelliJ IDEA and go to File > Settings (or Preferences on macOS).
      2. Navigate to Plugins in the left sidebar.
      3. Search for Cucumber for Java and Gherkin in the marketplace tab.
      4. Install both plugins and restart IntelliJ IDEA if prompted.
  3. Open the project:

    • IntelliJ IDEA will automatically detect and import the project as a Maven project.
    • Wait for the dependencies to be downloaded.

Usage

  1. Run tests:

    • In IntelliJ IDEA, open thesrc/test/java directory.
    • Right-click on any test file or directory and selectRun 'TestName'.
    • To run from the command line, navigate to the project root and execute:
      mvntest
  2. Jenkins Integration:

    • Create or configure a Jenkins job.

    • Add aBuild Step to run tests using thepom.xml file. Follow these steps:

      a.Add a Maven Project in Jenkins:

      • In Jenkins, click "New Item".
      • Enter a project name and select "Maven Project".
      • Click "OK".

      b.Source Code Management:

      • In the "Source Code Management" section, enter the Git repository URL.
      • Provide necessary credentials.

      c.Build Triggers:

      • In the "Build Triggers" section, select appropriate triggers (e.g., "GitHub hook trigger for GITScm polling").

      d.Build Steps:

      • In the "Build" section, click "Add build step" and select "Invoke top-level Maven targets".
      • In the "Goals" field, enterclean test.

      e.Post-build Actions:

      • In the "Post-build Actions" section, add "Publish HTML reports" and specify the path to the HTML reports (e.g.,test-output).

Parallel Testing

To run tests in parallel using TestNG XML files, you can use the providedParallelTest.xml,RegressionTest.xml, andSmokeTest.xml files. Follow these steps to enable parallel execution:

  1. Use theParallelTest.xml file:

    • Open theParallelTest.xml file located in thesrc/test/java/xml directory.
    • Ensure the suite tag includesparallel andthread-count attributes. For example:
      <!DOCTYPEsuite SYSTEM "http://testng.org/testng-1.0.dtd"><suitename="All Test Suite"parallel="tests"thread-count="2"><testname="Cross Browser Test - Edge">  <parametername="browserType"value="edge"/>  <classes>      <classname="runners._08_TestRunnerParallel"/>  </classes></test><testname="Cross Browser Test - Firefox">  <parametername="browserType"value="firefox"/>  <classes>      <classname="runners._08_TestRunnerParallel"/>  </classes></test></suite>
  2. Run the tests:

    • In IntelliJ IDEA, right-click on theParallelTest.xml file and selectRun 'ParallelTest.xml'.
    • This will execute the tests defined in the XML file in parallel, according to the configuration.

Folder Structure

cucumber-jdbc-ui-db-learning-path/│├── .idea/                      # IntelliJ IDEA configuration files├── src/│   ├── main/                   # Main source code│   └── test/                   # Test source code│       ├── java/│       │   ├── apachePOI/      # Apache POI│       │   ├── featureFiles/   # Gherkin feature files│       │   ├── jdbc/           # JDBC related files│       │   ├── pages/          # Page Object Model files│       │   ├── runners/        # TestNG runner classes│       │   ├── stepDefinitions/# Cucumber step definitions│       │   ├── utilities/      # Utility classes and helpers│       │   └── xml/            # XML configuration files│       └── resources/│           └── extent.properties    # Extent reporting configuration files│├── target/                     # Maven build output├── test-output/                # TestNG and Extent reports├── testReports/                # Custom test reports├── .gitignore                  # Git ignore file├── LICENSE                     # License file├── pom.xml                     # Maven configuration file└── README.md                   # Project README file

Dependencies

The following dependencies are defined in thepom.xml and required for the project to work:

  • Selenium: UI test automation.
  • Cucumber: Behavior-driven development (BDD) framework.
  • TestNG: Test framework for organizing and executing test cases.
  • Cucumber TestNG: Integrates Cucumber with TestNG.
  • SLF4J API: Logging facade for Java (used with different logging implementations).
  • SLF4J Simple: Simple console-based logging for development/testing.
  • DataFaker: Modern, actively maintained alternative to JavaFaker. Used to generate fake names, addresses, phonenumbers, etc.
  • Apache Commons Lang: Provides extra functionality for core Java classes, such asStringUtils,ObjectUtils,ArrayUtils, etc.
  • Apache Commons IO: Simplifies input/output operations with utilities likeFileUtils,IOUtils, and streamhandling helpers.
  • ExtentReports Cucumber Adapter: Generates rich test reports with Cucumber.
  • Apache POI: Read/write Excel (XLS/XLSX) files.
  • Apache POI OOXML: Support for Office Open XML (XLSX) formats.
  • MySQL Connector/J: JDBC driver for connecting to MySQL databases.

Deprecated Dependencies

  • JavaFaker was previously used for data generation but has been replaced withDataFaker due to maintenance andsecurity concerns.

Contributing

Contributions are welcome!

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add new 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 theLICENSE file for details.

Contact

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


About

A comprehensive test automation framework for UI and database testing using Cucumber, Selenium, JDBC, and TestNG. Includes cross-browser support, parameterized testing, and detailed reporting with ExtentReports.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp