Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vamsi1810/testsmartapiautomation

This repository is about performing API testing through Rest Assured automation framework on the api's provided AngelOne
https://github.com/vamsi1810/testsmartapiautomation

gson jackson-databind java-21 json-path json-schema-validator maven objectmapper okhttp3 rest-assured-framework testng-framework validation-api

Last synced: 5 days ago
JSON representation

This repository is about performing API testing through Rest Assured automation framework on the api's provided AngelOne

Awesome Lists containing this project

README

        

# Smart API Automation Project

This project implements API automation for Angel One's Smart API using the REST Assured framework in Java. The goal of this project is to ensure that the API responses conform to the expected standards, including validating response codes, verifying the schema, and ensuring that data types are correctly mapped.

## Project Overview

The API testing in this project focuses on the following key aspects:




  • Request Validation: Hitting APIs based on their respective request types and verifying if the response contains the expected status codes.


  • Response Validation: Ensuring that the response data conforms to the expected schema and checking that each field adheres to the correct data types (e.g., String, long, int, Date, etc.).


  • Schema Validation: Verifying the API responses against predefined JSON schemas using the json-schema-validator library.


  • Data Management: Test data is fetched from JSON files and supplied to the API requests using TestNG's DataProviders. The data is converted to the supported schema types before being passed into the request object, ensuring that no invalid data is processed.

## Dependencies

The following dependencies are used in the project:




  • REST Assured: For API testing and validation.


  • TestNG: For managing test cases, assertions, and DataProviders.


  • Gson: For JSON parsing and serialization.


  • Maven: For dependency management and project build.


  • JSON-Path: For extracting data from JSON responses.


  • OkHttp3: For making HTTP requests.


  • JSON-Schema-Validator: For validating API responses against predefined schemas.


  • Jackson-Bind: For handling JSON data binding.

## Project Workflow

The project workflow consists of the following steps:




  • Request Execution: API requests are sent based on the appropriate HTTP methods, with data retrieved from external JSON files. These requests are structured to ensure compliance with the Smart API's documented formats.


  • Response Handling: The received API responses are evaluated to ensure that the status codes match the expected outcomes. Further validation checks are conducted on the response body to ensure compliance with the predefined JSON schema.


  • Data Type Mapping: The fields in the response object are checked to ensure they are correctly mapped to their expected data types, such as String, int, long, Date, etc.


  • Assertion and Validation: Using TestNG assertions and Hamcrest Matchers, we validate that the API responses meet the expected conditions.

## How to Use

Follow these steps to run the project:



  • Clone the repository.

  • Ensure you have the following installed:


    • Java (JDK)

    • Maven


  • Run mvn clean install to install dependencies and build the project.

  • Execute the test suite using TestNG to run the API tests.

  • Review the test results for validation of the API responses.

## Conclusion

This automation project ensures the reliability and accuracy of API responses by combining data-driven testing with extensive schema and data type validations. The use of REST Assured and other supporting libraries helps maintain a robust testing framework, ensuring that the Smart API is functioning as expected.