Sunday, July 21, 2024

Understanding and Implementing Rest Assured using workflows and MindMap

Understanding Rest API

A REST API (Representational State Transfer Application Programming Interface) is a set of rules and conventions for building and interacting with web services.

Below diagram show the principles/workflow and response status code for Rest API.


Key Components of Rest API


1. Endpoint: This is the URL where the API can be accessed. Each endpoint corresponds to a specific resource or collection of resources.

2. HTTP Methods: These define the action to be performed on the resource. These are also known as CRUD (create, request, update and delete) operations

- GET: Retrieve data from the server.

- POST: Send data to the server to create a new resource.

- PUT: Update an existing resource with new data.

- DELETE: Remove a resource from the server.

3. Headers: These provide additional information with the request or response. Common headers include Content-Type (indicating the media type of the resource) and Authorization (containing credentials to authenticate a user).

4. Parameters: These are used to modify the request. They can be included in the URL (query parameters) or in the request body.

5. Request Body: This contains the data sent to the server when making POST or PUT requests. It's typically formatted in JSON or XML.

6. Response Codes: status of the request.




Common Crude actions/verb and response status code mapping

Understanding Rest Assured


REST Assured is an open-source Java-based library designed for testing and validating RESTful web services. It integrates well with testing frameworks like TestNG and JUnit. Below are key things, we will discuss in the article to keep it short and refresher only.

Basic Workflow for getting response from Rest requests for different verbs


Basic Workflow for getting response from Rest requests for different verbs

Code Understanding for basic operations 



How to Fit Rest-Assured tests in Framework


MindMap for basic framework with rest assured

Please comment, in case any observations/queries in understanding the process and documentation

Reference for learning :


Rest API - https://www.ibm.com/docs/en/mfci/7.6.1?topic=apis-rest-api

JSON cheat-sheet - https://codebeautify.org/json-cheat-sheet

JSONpath cheat-sheet - https://gist.github.com/mackoj/5786f8b95da0a82e8e003f444c4295bf

Understanding hamcrest :

https://www.baeldung.com/java-junit-hamcrest-guide

That's all for this article.Please comment, in case any observations/queries in understanding the proce
ss and documentation

No comments:

Post a Comment