Giter Site home page Giter Site logo

anshul-sonpure / api-testing-framework Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 267 KB

API Testing Framework build using Java + rest assured and extent reports for reporting. Data Driven API testing framework where data is being fetched from Excel and Logger implemented to logs all the details.

Java 6.20% HTML 85.67% CSS 5.19% JavaScript 2.95%
api-framework api-testing api-testing-framework jwt-authentication-flow jwt-authorization rest-assured-framework

api-testing-framework's Introduction

API Testing Framework

This API Testing Framework is built using Java and RestAssured, which is a popular library for testing RESTful APIs. It is a data-driven testing framework, which means that test data is fetched from an external source, in this case, an Excel spreadsheet. The framework is designed as a data-driven testing framework, meaning that test data is stored in an external data source such as an Excel file, and the framework reads the data from the file during test execution. This allows for easy maintenance and updates to test data without requiring changes to the actual test code. The framework includes an implementation of the Logger, which is used to log details during the execution of tests. This feature helps in debugging and identifying issues during the testing phase. The Logger can be customized based on the user's requirements and can be used to output logs to different sources such as the console, log files, or database. For reporting purposes, the framework uses Extent Reports, which is a powerful reporting library that generates HTML reports. These reports include information about the tests that were run, their status, and other details such as the time taken to execute the tests. The reports can be easily shared with other team members and stakeholders to keep them informed about the testing progress and results. Overall, this API Testing Framework provides a comprehensive solution for testing RESTful APIs. Its data-driven approach allows for greater flexibility in testing different scenarios and its use of Extent Reports and Logger ensures that test results are well-documented and easily accessible and customizable.

Features

  • Data Driven framework based on Excel
  • Implementation of Loggers so that user can log info,warn,debug or trace call based on requirement
  • Reporting can be done using extent report which can be customized as per need

Folder Structure

The folder structure of your API Testing Framework consists of the following:

  • src/main/java: This is the main source code directory that contains all the Java packages for the framework.

  • AdequateEndpoints: This package contains the methods to perform CRUD operations for Adequate endpoints. The response is sent back so that it can be called in test scripts.

  • MobileEndpoints: This package contains the methods to perform CRUD operations for Mobile endpoints. The response is sent back so that it can be called in test scripts.

  • Payload: This package contains POJO (Plain Old Java Object) classes that can be utilized in test scripts to create objects and set values in variables. These objects can then be sent as payloads in the POST request body.

  • Utils: This package contains utility files like FileUtil, DataProvider, ExcelUtil, ExtentSetup, and ListenerTest.

  • FileUtil: This class takes two parameters: a file path and string data. Based on the file path, the data will be written in the file.

  • DataProvider: This class reads data from Excel and then can be utilized in test scripts to create objects and set values in variables. These objects can then be sent as payloads in the POST request body.

  • ExcelUtil: This class reads data from an Excel file.

  • ExtentSetup: This class sets up the Extent report.

  • ListenerTest: This class logs data based on test result such as test pass, test fail, or test skipped.

  • Routes: This package contains the endpoints for the API.

  • src/main/resource: log4j2.xml file which is configured for two loggers and each logger logs the data in Logs folder with separate file name(Adequate,Mobilestore).

  • product-schema: This is the json-schema which is used to validate the json response back when post call is made.

  • src/test/java - Contains package testEndPoints inside it we have written testcases for each endpoint(Adequate,Mobilestore).

  • src/test/resource: contains files like testdata excel for mobilestore, login and register token and properties files.

Overall, the structure follows a modular approach with separate packages for endpoints, payload, utilities, and routes. This makes it easy to maintain and extend the framework. The use of POJO classes and DataProvider helps to achieve data-driven testing, while Extent reporting provides detailed reports for better analysis.

Installation

If you want to run the code locally you can clone the repo and run either using testng.xml or mvn clean test command.

You can also integrate pom.xml with Jenkins and run the scripts on CI/CD pipeline.

All the Logs are being generated in Logs folder and Extent-Report is generated in Reports folder. You can change the logging information as per your need in both logger and extent report.

You have any suggestion you are most welcome. We can connect over email for anything required.

Thank You
Happy Coding,
Learn,Code and Earn
Stay Safe and Stay Positive :)

api-testing-framework's People

Contributors

anshul-sonpure avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

mdhuvinay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.