REST Client Testing using Restito Tool

Software TestingAutomation TestingTesting Tools


REST (Representational State Transfer) is a modern technique of enabling communication between two software systems. One such system is known as REST Client; the other is known as REST Server. It is an architectural technique based on a stateless communications protocol, such as HTTP. It organizes or structures data in XML, YAML, and other machine-readable formats. However, JSON is mostly used. REST is based on objectoriented programming model.

REST is data-driven, unlike SOAP which is function-driven. REST is also referred to as RESTful APIs or RESTful web services. The description format of REST services does not follow a standard. REST service can be imported in SOAPUI using WADL files. ReadyAPI is compatible with OpenAPI, Swagger and RMAL formats. The basic REST HTTP requests includes: POST, GET, PUT and DELETE.

  • POST − Adds new data.

  • GET − Read or retrieves existing data.

  • PUT − Updates existing data.

  • DELETE − Remove existing data.

REST offers more flexibility than SOAP and is much easier to use.

Advantages of REST over SOAP

  • REST uses simple and understandable standards, such as Swagger and OpenAPI Specification 3.0.

  • REST has a smaller learning curve.

  • More efficient as it uses smaller message formats (like JSON), unlike SOAP, which uses XML for all messages.

  • It is faster, and does not need extensive processing.

REST Client

REST client is a technique or tool used to invoke a REST service API which is open to communicate with any other system or service provider. For example, if an API is expected to get real-time traffic data about a route from Google, then the software invoking the Google traffic API is known as REST Client.

REST Server

REST Server is an API or a method to enable a system to be open to communicate with another system or service provider. For instance, Google enables an API to get real-time traffic data on a given route. Google’s server must be up and running to attend to any request to the API from different clients.


Consider a vehicle-booking application such as Uber that needs real-time information of the traffic around the routes the vehicle is located in.

REST Client

The client is an Uber application the driver is logged into. It sends requests to the REST API of the Google Maps so as to get real-time information, for instance, a HTTP GET request.

REST Server

Google is the service provider. The API of Google Maps provides the required information to an Uber app’s request. Note that the client and server are equally significant REST communication.


Restito is an app or a framework developed by Mkotsur. This lightweight app helps execute all kinds of HTTP requests. It can also be sued to test REST APIs as well as to search problems in the application or the network. This tool is inspired from Mockito and its functionality is diametrically in contrast to that of the Rest Assured.

Karate DSL is a tool for API automation testing, performance and load testing. It runs on Java and uses Apache HTTP to execute Http connections. DSL has its own scripting langue; DSL- Domain Specific Language; which is easy and can be used by people with zero coding experience. It has a predefined set of scripting command for operations one might need while interacting with APIs.

Restito offers a DSL −

  • To imitate REST Server behaviour.

  • To record HTTP calls made to the server.

  • To verify happened calls.

Basically, Restito helps test an application that makes calls to a HTTP service. It establishes a StubServer instance that can respond to calls made by an app based on defined Stubs. A stub enables an action to respond when condition is requested.

Testing REST Client with Restito

The testing of the REST Client is broadly divided into 4 main steps as follows −

  • Create a HTTP Client and method for sending a GET request to the server endpoint.

  • Start a Restito server, record the requests received by the endpoint “getevents”.

  • Create a test class to test the client created in step 1. Call on the HTTP Client “sendGETRequest” method to start a GET request to the “getevents”.

  • Authenticate the HTTP GET call using Restito framework.

Advantages of using Restito for REST Client testing

  • Actual REST server is not needed to be developed for testing the REST Client.

  • It offers strong varied services and methods to imitate behaviour of a server. For example, for testing the REST Client behaviour when server responds with 404 error or 503 error.

  • Restito servers can be established in milliseconds and can be closed after all the tests are executed.

  • It supports all HTTP method contents, e.g., compressed, non-compressed, unified, etc.

Disadvantages of using Restito for REST Client testing

  • REST Client sources must be adjusted for taking into account “localhost” as a server machine.

  • If commonly used port like 8080 or 9443 is used. opening server in a port may conflict.

  • Many proponents of REST Client testing with Restito advise using ports like 9092 or 9099, but they are not commonly used by other tools.


  • REST- Representational State Transfer – is a modern technique of enabling communication between two software systems.

  • REST Client is a tool/technique to enable a REST API that is open to communicate with any system or service provider.

  • In RestServer API that is open to communicate with any system or service provider.

  • Restito is a lightweight app of framework that helps execute HTTP requests of any kind.

  • In this article, we discussed examples of automation testing of only the REST Client.

  • For developing test cases to test the REST Client, we do not need an actual REST server.

  • REST Client source can be adjusted to treat localhost as a server machine.

Updated on 23-Sep-2021 09:37:11