top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

About Rest ASSURED

In this topic we can learn about what and how to use rest assured.

REST means REPRESENTATONAL STATE TRANSFER, REST is an architectural style that uses simple HTTP calls for inter-machine communication.


WHAT IS REST ASSURED? REST-assured is an Open-Source Java library that is used to test and validate REST APIs, it is extensively used to test web applications that are based on JSON and XML.


WHY REST ASSURED?

There are many ways to test API's, one of the most popular AUTOMATED testing tool is "Rest Assured". This has gained popularity in recent years for

(i) Code Reusability: example- Reusable Request specifications.

(ii) Follow BDD/Gherkin for readable behavior driven test cases.

(iii)Inbuilt library of Assertions, Matchers and Extractors.


Rest Assured has a gherkin type syntax which is shown below code:

RestAssured.get(“Api/URL.”). then (). assert That (). status code () here we can observe method chaining between get (). then (). assert that ()

Request Specifications: Request specifications in rest assured it is used to group together common request specs and turn them into a single object.

Request Specification is an interface that allows you to specify how the request will look like. This interface has readymade methods to define base URL, base path, headers, etc.

Request Specification request Specification =RestAssured.given(). base Uri(“URL"). base Path (“/ your basepath”);

REST Assured supports POST, GET, PUT, DELETE, PATCH requests and can be used to validate and verify the response of these requests.

Below are the steps to configure Rest-Assured in IDE.

  1. Download and setup Java.

  2. Setup TestNG in Eclipse.

  3. we need to create a maven project in ECLIPSE and add the below dependencies in POM .XML file

4.select the below dependencies from MAVEN REPOSITORY


. REST ASSURED, JSON PATH, JSON SCHEMA VALIDATOR,JUNIT/ TESTNG

POM.XML file with required dependencies were added.

Summary: What is Rest Assured and where we use it and how to add rest assured dependencies in maven were covered in this blog.

Thank you for reading my blog …


69 views0 comments

Recent Posts

See All
bottom of page