REST Assured and Prerequisites to start REST API Automation Testing.

This blog will help you to initiate the API Automation testing with the REST Assured library.
In this blog, we will cover the below topics required.

  • What is REST Assured in REST API Automation Testing?
  • Prerequisites to start REST API Automation Testing.
    So Let’s directly jump to our topics.

What is REST Assured?

REST Assured is a Java library by which we can do REST API testing easily.It supports many HTTP methods like GET, POST, PUT, DELETE, etc. It uses the BDD(Business Driven Development) process.

Prerequisites to Start REST API Automation Testing

  • REST Assured supports multiple languages and with the help of REST Assured, we can test any application which provides an HTTP response. Out of multiple languages, We have chosen JAVA language to start testing with REST Assured, some basic knowledge and concepts of JAVA are required. Like Object, Class, Method, Conditions, Array, String, etc.
    Here is the link for more information about the same.
  • As we are doing REST API automation testing so, basic Knowledge of API, HTTP Methods (like GET, POST, etc.), and how we test API manually are required.

Providing some basic details here :

We can access API by endpoint URL.
Syntax of endpoint URL:

Base URL/ Resource / (Query / Path ) Parameters

Here Base URL represents the server name and IP address where the request should go.
Here Resource represents which API should point out or should call.
Here Parameters provide input value to resource and whether parameter will be Query or Path, it depends on API nature.

Example:

https://reqres.in/api/users?page=2

Here we used the reqres.in site for reference.
Here https://reqres.in/ is the base URL.
Here api/users is the resource.
Here we used query parameter i.e. ?page=2

Some of the HTTP method syntax and information am sharing here, for more details of the HTTP method you can check here, and for learning about Manual API testing with Postman you can check here.

HTTP Methods:

GET Method:
This method is used for retrieving the data from the server as per the requested API.
Example: Here for every example, we used the reqres.in site for reference.

POST Method:
This method is used for sending/creating the data to the server.
Example :

PUT Method:
This method is used for updating the existing data.
Example:

DELETE Method:
This method is used for deleting the data from the server.
Example:

PATCH Method:
This method is for updating the existing data partially instead of the complete data update.
Example:

HTTP Status Codes:
Whenever we send a request to the server, the server responds with a response in the status code, which indicates whether a specific HTTP request has been successfully completed or not. For more details on the response status code, please check here.
Last but not least for starting REST API Automation Testing we require some tools.
Tools information and installation process for API automation testing with REST Assured, We will cover in the next blog. So stay tuned.

Neha Dadhich

Neha Dadhich

I am a QA professional, I believe in the overall product quality instead of testing only and always try to contribute on each level.