Let’s proceed with the following Rest Assured components and features that make it so popular in the modern testing and development world. This powerful library provides you with a large set of functionalities. I will list a few the most important and commonly used amongst them. They are the following:
- First, HTTP requests can be sent with the help of this library. Basic interface for this operations is called as Request Specification in Rest Assured. It provides you with a great number of request configurations available. Just a few of them are query parameters, path parameters, request body, headers, authorization, cookies, etc.
- Second, HTTP responses can be represented as Java objects defined in Rest Assured. The basic interface that stores web services response is called as Response. A lot of useful data such as response cookies, content type, body, status code are stored inside this object.
- Third, JSON Schema validation is an integral part of this library. It allows you to work with JSON Schemas and check the correctness of response body structure and content with the help of a few JSON files stored somewhere in your project. Moreover, this functionality provides you with a chance to see a pretty error messages with information about what is wrong with your response’s body.
- Fourth, Status Codes validation are present in Rest Assured. You can operate with the RESTful web service’s response as a Vaildatable Response object with the help of this library. In its turn, it allows you to verify the status code from the server, and with the structure of chain of invocations, provides you with an opportunity not to run further checks, if this is failed.
- Finally, Body validation is important piece of Rest Assured. It helps you to see separate parts of your response’s body and understand if they meet your expectations or not. Additionally, it allows you to check the body’s content with the help of built-in assertion’s mechanisms, so you don’t care about more external dependencies for your project.
