REST Assured Tutorial
Introduction To REST API Testing
What Is An API ?
Application Programming Interface(API) is a documented interface that allows services and products to communicate with each other through data exchange. It is simply a software intermediary which relies on client-server architecture. It is a defined set of standard rules that works as follows :
A client application initiates an API request.
The API processes the request after validating it.
After validation,API passes the request to the web server.
Server sends the information as per request as a response to the API.
The API transfers the data to the requesting application.
Four major kinds of APIs :
Open APIs
Partner APIs
Internal APIs
Composite APIs
To achieve a standarized information exchange, APIs have some protocols :
SOAP
XML-RPC
JSON-RPC
REST
Since REST is the part of our testing, so we will focus on this only in our further articles.
What Is REST API ?
Representational State Transfer(REST) is an architectural style that defines a set of constraints for designing principles of web services. This technology is most preferrable because of its simplicity, flexibility and robustness. All communication done via REST API uses only HTTP requests.
For an API to be considered as REST API, it must have these six architectural constraints :
Uniform interface
Client-server decoupling
Statelessness
Cacheability
Layered system architecture
Code on demand(optional)
What Is API Testing ?
API testing is a software testing practice where APIs are tested to determine if they meet expectations for functionality, reliability, performance and security. Typically, applications have three separate layers as :
Presentation Layer(User Interface)
Bussiness Layer(Application User Interface)
Database Layer(Database)
And the API testing is performed at the most critical layer of software architeture, the business layer. In which business logic proccessing is carried out and all the transactions between the user interface and the database layers happen.
Why Should We Perform API Testing ?
There are so many benefits of testing an API. Some of them are mentioned below :
Language independent
GUI independent
Improved test coverage
Faster releases
Reduce testing cost
What Are The Types Of API Testing ?
Following are the types of API testing that can be performed :
Validation testing
Functional testing
UI testing
Security testing
Load testing
Runtime and error detection
Penetration testing
Fuzz testing
What Are Some API Testing Tools ?
We need a tool to structure and manage our test cases for API testing. Below are the name of some tools :
SoapUI
Postman
Katalon Studio
Tricentis Tosca
REST-Assured