This is a full-fledged tutorial on Rest API Automation testing using one of a very popular Java-based API i.e ‘Rest Assured‘ library. It is in high demand among automation testers. In this guide, we are going to present solutions that are easily understandable and quick to implement and use. This rest assured tutorial is not only for beginners but for advanced users as well.

Rest Assured is a Java-based library. It is one of the most popular libraries to test RESTful Web Services and used to perform testing and validation of Rest Services with simplicity. It can be considered as a wrapper implementation of the HTTP client library as it underneath performs the same operations as what HTTP client API does. RestAssured API is highly scalable and customizable and can be really effective to create extensive Requests to tests a particular service.

Check out: KARATE DSL (API Testing) TUTORIAL with examples (Latest 2019)

It provides a BDD-like structure to write the code that is one of the advantages of using it as it makes it simple to use.

As I’ve mentioned above that it is an implementation over the HTTP Client library, therefore, it would be simple to write the code in the REST-ASSURED as it is more refined and high level.

As it is a Java-based library, so it would be very easy to integrate with the UI test code in the automation testing framework.

Also, in this particular guide, we are going to use JSONPath for JSON manipulation and Hamcrest API for assertions.

Let’s have a look at REST-assured Syntax:

Let’s give you a brief idea here about how the above-mentioned code operates:

a. As per the above example, there is no method been passed to ‘given‘. It means there are no specific preconditions there.

b. There is a ‘get’ method which is being passed to ‘when‘ and it signifies that when we are hitting this URL present in the ‘get’ method, an event occurs.

c. When we hit the URL in ‘when’, ‘then‘ we are going to receive output as a response, and then we perform validation on it. Here in this particular example shown in the above image, we are performing an assertion on the body by validating the size of a specified element.

Let’s jump on the thorough REST Assured tutorial for beginners/advanced users, here we are going to cover the below topics:

Other Useful References:

Related Posts:

[wcp-carousel id=”5342″]

[icegram campaigns=”6007″]