Meet 2025’s Top-rated Software Test Management Tool. Learn More >

REST Assured Overview

REST-assured Overview

In this article

Automating the API Testing has never been an easy task. Right from the initial API Testing setup, sequencing API calls to testing parameter combinations, API Testing as a whole has several challenges. Don’t worry! I have shared an overview of REST API, the REST Assured framework and how the framework will help simplifying API Testing using automation.

What is API?

API stands for Application Programming Interface. It acts as an interface between different software systems and establishes their interaction and data exchange.

What is REST API?

REST means REpresentational State Transfer. REST is an alternative to SOAP (Simple Object Access Protocol) and instead of using XML for request REST uses simple URL.

REST API supports both XML and JSON format. It is usually preferred for Mobile and web apps as it makes app work faster and smoother and the supported HTTP methods are GET, POST, PUT, DELETE.

What is REST Assured?

REST-Assured is a Java-based library that is used to test RESTful Web Services.REST Assured is a Java domain-specific language (DSL) for testing REST services. Supports Response parsing and assertions.

Steps to automate the REST API Get Request

  • Create a maven project on eclipse
  • Add the below dependencies in POM.xml file

<dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>3.0.2</version>
        <scope>test</scope>
</dependency>
<dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
        <scope>test</scope>
</dependency>
</dependencies>

  • Create a package and class file.
  • Within this class file we need to call the required rest assured methods to call the API and obtain the response code and the message.
  • Use the RestAssured class to generate a RequestSpecification for the URL: http://restapi.demoqa.com/utilities/weather/city/Chennai
  • Mention the HTTP Method type and send the Request to the server
  • Get the Response back from the server
  • Display the returned Response’s Body in Console

Sample Code snippet

import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.http.Method;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;

public class SimpleGetRequestTest {

	@Test
	public void GetWeatherUpdate()
	{   
		RestAssured.baseURI = "http://restapi.demoqa.com/utilities/weather/city";
                        RequestSpecification httpRequest = RestAssured.given();
		Response response = httpRequest.request(Method.GET, "/Chennai");
		String responseBody = response.getBody().asString();
		System.out.println("Response body for the given request " + responseBody);

	}

}

Output Window

The below response will be displayed in the Eclipse console window for the above request

{
    "City": "Chennai",
    "Temperature": "31.98 Degree celsius",
    "Humidity": "63 Percent",
    "WeatherDescription": "broken clouds",
    "WindSpeed": "4.6 Km per hour",
    "WindDirectionDegree": "130 Degree"
}

 

You would have by now understood what a REST Assured Framework is and how to automate the REST API Get Request along with a sample output. API Testing is an ocean by itself and with the automation disrupting everything, it is important for us to know how to align with the changes.

Having said this, I am ready to hear your thoughts about this blog and any additional insights with regards to Rest Assured Framework. Do post what you think in the comments section below!

Reference

https://www.toolsqa.com/rest-assured-tutorial/
https://devops.com/top-6-challenges-api-testing/

 

 

 

Picture of Kannathasan

Kannathasan

Kannathasan is a Certified Software Tester (Foundation Level ). He loves testing eCommerce applications and ferreting out hidden bugs. He likes solving challenging puzzles during his free time.

All Posts

Deliver quality software with QA Touch

Questions? Explore our docs, videos, and more just one click away!

Real people with life changing results

Insights from QA Teams on QA Touch’s Impact

Frequently asked questions

Everything you need to know about the product and billing

Why QA Touch?

QA Touch is an AI-driven test management platform built by testers for testers. It simplifies collaboration between developers and QA engineers while helping to manage, track, and organize test cases efficiently. Streamline your testing processes, enhance QA visibility, and deliver high-quality software with ease.

QA Touch offers comprehensive features to manage the entire test management process. From easy migration with CSV files to audio-visual recording of issues and activity logs and a shareable dashboard for real-time reporting to stakeholders, we ensure the testing teams are always on top of things.

Our focus is on providing complete visibility and control over testing workflows and fostering collaboration between testers and other stakeholders (both internal and external). You can have a look at all the features here.

Once you sign up, it takes only 30 minutes to get your QA Touch account up and running. After registration, you will receive an account activation email with all the details. Log in with your account details and create your first test project on QA Touch—it’s that simple. You are now ready to start inviting your team and assigning them roles.

If you are finding it difficult to log in or facing any difficulty, feel free to reach our support team at info@qatouch.com

Why is QA Touch the best test management tool for me?

QA Touch is an AI-driven test management platform that simplifies collaboration between your developers and testers. Beyond creating, organizing, and executing test cases, QA Touch enables you to manage projects, track bugs, and monitor time—all in one platform.

With an intuitive UI and seamless two-way integrations, QA Touch adapts to your workflow, making test management, project oversight, and bug tracking smarter and more efficient.

With secure OKTA, Microsoft Azure SSO, and Google SSO enterprise features, you can stay connected in every app.

We have integrations with dozens of major apps like Slack, Jira, Monday.com, Cypress, and many more. Explore the whole list of integrations now supported here: Explore integrations

The test management tool is a modern software application that helps QA teams and developers manage their testing process efficiently. It provides a structured approach to creating, organizing, executing, and tracking tests to ensure software applications meet specified requirements and function properly before release.

Don’t just take our word for it.

QATouch is a leader in G2 market reports.