top of page

Rest Assured API

Why API Automation?

Early Defect Detection

Most UI layers use REST webservices to fetch data from backend and do the business validation any issues with REST services will found before developers actually consumer that web services. It will saves development time over the defected webservices.

Contract Validation

In distributed environment different scrum teams involved in the single functionality. If one team changes some parameters related to web service which consume by team by last sprint and if they failed notify the team. This will lead to production defect of that functionality which is not part of the current to avoid this validate contract is very important thing.

Stops further build

If test failed in automation environment, It stops the further build until the error is rectified. Its the very good practice to pass testers for testing.

Fast Result

This help in Regression testing suit for an application. Its very important in CI/CD (Continuous integration/continuous deployment)environments will take less time to complete test cycle.


If tests are passed without any issue then business layer is not having any defect.

Test Pyramid

API Automation involves significant role in building the test pyramid. Unit test cases have more numbers which helps automation framework.

What is REST?

  • REST(Representational State Transfer) is an approach to communicate in the development of Webservices

  • REST uses HTTP protocols to communicate


  • Uses URIs

How to send request using HTTP GET?

Status code : 200

    "data": {
        "id": 2,
        "email": "",
        "first_name": "Janet",
        "last_name": "Weaver",
        "avatar": ""
    "support": {
        "url": "",
        "text": "To keep ReqRes free, contributions towards server costs are appreciated!"


  • REST Assured is a java library for testing of REST services

  • Integrates with existing java based testing frameworks like Junit,TestNG and Selenium WebDriver

  • REST Assured Features

  • Support for HTTP methods

  • supports for BDD/Gherkin(Given,When,Then)

  • Uses Hamcrest matches for checks(like equql to)

What REST Assured gives?

  • Format HTTP request

  • Send it over to the network

  • Validating HTTP Status code of a request

  • validating response code

REST Authentication mechanisms

  • Basic Authentication(Username and password)

  • OAuth

  • Digest

  • sessionbased Authentication

Getting started with REST Assured

Maven Dependency of REST Assured







Writing Test

given() ----------> Information about the URI


When() ------------> Action


Then() --------------> Validation


How to write HTTP GET Request?








This is the simple way of sending request and validating the response code.

90 views0 comments


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page