restassured maven code example

Example 1: maven dependency for restassured

This include all basic component of RestAssured

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>

</dependency>

If we want to use serialization , de-serialization
we will need Jackson-Databind

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.11.2</version>
</dependency>

If we need Json schema validation

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>
</dependency>

JsonPath and XmlPath is already included in the
RestAssured dependency, If you want to work with
JsonPath and XmlPath outside context of RestAssured
, you may also add below 2 dependencies.
It will enable you to directly work with
json file or xml file and use JsonPath and XmlPath.

<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>json-path</artifactId>
      <version>4.3.1</version>
      <scope>test</scope>
</dependency>

<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>xml-path</artifactId>
      <version>4.3.1</version>
      <scope>test</scope>
</dependency>

Example 2: what is rest assured library

A non-web service API that's BDD format and helps
integrate java code using deserialization and
serialization to extract data from the Json and
transform it into a java object in order to store,
verify, and validate the data to the expected one.

Tags:

Misc Example