Home » restAssured-tutorial » Introduction of Rest Assured

Newly Updated Posts

Introduction of Rest Assured

Previous Topic, In this tutorial we will learn the overview and Introduction of Rest Assured API and the advantage.

What is Rest Assured?

Rest Assured provides the capability to test your Rest Representation State Transfer services using java and integrate with build tools like maven, Ant etc. Rest Assured Api has different method that helps to trigger your request payload and get the expected response.

Introduction of Rest Assured

Further with the received payload or in other words the output , we can get the required data and validate our automation as per the requirement.

Suppose you are looking for online hotel booking, and login to OYO rooms. As during the hotel search you come up with all the available hotels on the place along with the details of the available rooms from a defined time interval.As we are aware that all the hotels are not belongs to OYO ownership, so how the OYO manages to show them all. The answer is due to exposed APIs of these hotels providers.

If we are required to test this type of application UI before the development or during the development its not possible, so testing API is very important and testing repeatedly with different sets of data or parameterized data sets.

Advantage of Rest Assured

1) The major advantage of rest assured is it removes the writing of complex code for http connection, send the request and receives a readable response.

2) Rest Assured works on the basis of 3 principles, Given(), When() and Then(), which makes easy to provide the parameter and receive the readable code.

3) Being Rest Assured as java API, the integration with other tools becomes quite easy, it can easily connect with maven , testng etc.

Working Principle of Rest Assured

Rest Assured works on the basis of 3 principles Given(), When(), Then()

1) Given(): Given Keyword are the pre-requisites or the request parameter that is passed like header, query Parameter, request body.

2) When(): When keyword keeps the resource url, for the specific service to work with.

3) Then(): Under then keyword, we provide the assertions and matcher conditions or in other words all the validation work is performed to this keyword.

So, in next tutorial we are going to setup the Rest Assured and try with a sample application.