What’s up guys! Welcome to My blog and thanks for looking Rest Assured page.


 Reading Time: <10 Minutes

RestAssuredCore is a wrapper build on top of Rest Assured Library. The idea is used to customize Rest Assured Library Methods and implemented custom methods and reusable components what exactly is required for specific project requirements.

To clone/download this framework, please feel free to visit: https://github.com/automationcalling/restapi_restassured.git

Features and Scope of this Framework:

  • Built using Method Chaining in Java
  • Supports http and https RestAPI call
  • Supports curl
  • In-build validation for XML and Json response using Hamcrest Matcher as well as extract value for TestNG Assert validation
  • Code Quality and standard compliance with Sonar
  • Can easily integrate this wrapper with your Selenium Hybrid or Cucumber Frameworks
  • Supports Authentication like Basic, SSL (Certificates) but OAUTH needs to be added soon
  • Wrapper supports for End-to-End Automation
  • Can help to start automation from the day 1 and easy integration
  • Supports Payloads(File type) for PUT/POST request.
  • Possible to reduce your code as well as able to implement 1 line code.


  • This page is purely based on Rest Assured Core Automation, so I request you guys to brush up Core Java and Rest Assured concepts.
  • Rest Assured is an open-source Java Domain-Specific Language which makes automating RestAPI Call is very simple. Please take a look on this link http://rest-assured.io/ and get familiarizaiton.

Rest Assured Core Architecture:


RestAssuredCore class Implemented custom methods from Request Specification
Response class Holds response object (Java bean class) as well as support validation using Hamcrest Matcher in this class

Test Script Implementation Strategy:

All RestAssuredCore Method must be called before Call the method “InvokeRestCall”, after invoked it doesn’t return RestAssuredCore implementation method rather it display Response Class Method and Hamcrest Matcher Validation Methods. So, the idea is you must initialize/call all your request related attributes for eg., initialize baseURI, basePATH, resourcePath, setting body, header, content type etc before Invoking “InvokeRestCall” method, this is same technique as how Rest Assure Library implemented.


Here’s an example of how to make a request and validate the JSON or XML response

This framework supports two types of validation for Response Object

  • Hamcrest Matcher: Added wrapper method which supports in-build in “Response Class
try {
    new RestAssuredCore((CommonUtil.returnProperties(Constant.PROPRETYFILEPATH, "serviceBaseURI"))
            , CommonUtil.returnProperties(Constant.PROPRETYFILEPATH, "serviceBasePath"))
            .invokeRestCall("GET", "get/IND/UP")
} catch (Exception e) {

The above snapshot we pass baseURI, basePATH, resourcePath and url encoding and final invoke rest call and validate status code in using hamcrest matcher validation method.

  • TestNG Validation: In Response class, you have to use getXXXX (Method start with get) where it return either integer or string based on method. Having return value you can implement TestNG assertion. For eg.,
public void validateResponseCode() {
 int statusCode = restAssuredCore.invokeRestCall("GET", "/all").getStatusCode();
 Assert.assertEquals(statusCode, STATUSCODE_200);

The above code is quite readability and understandable. There are some examples available in GitHub where you can go ahead play with those.

Thanks for your time! please post your comments if any questions or clarifications, contact me @automationcalling@gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s