
POSTMAN is an API/Web services testing tool which is used for testing APIs by sending a request to the web server and getting the responses back.
Before knowing about POSTMAN in detail we must know what is API and what is web service.
API – Application Programming Interface is a software intermediary that allows two applications or components to communicate with each other in a set of defined methods
Web service – Web service is a service offered by an application installed on a particular device or server to another device or client application. These services can be implemented in many ways and the most prominent implementations are through SOAP(Simple Object Access Protocol) service and REST(Representational State Transfer) service.
Why We have to do API Testing?
- In order to make sure live API endpoints are up, fast and returning the data that are expected.
- Iterating on API tests will make applications stronger and more comprehensive, which raises the product quality.
- API testing during development can reveal issues with your API, server, other services, network and more that may not discover or solve easily after deployment.
- Reusing API tests facilitates collaboration among teams and provides are more comprehensive and accurate testing action.
- GUI tests can’t sufficiently verify functional paths and back-end APIs/services associated with multi-tier architecture.
There are ample number of tools available for web service testing and this blog gives an overview of POSTMAN-REST client tool which follows Representational State Transfer architecture for testing web services.
POSTMAN Setup
Postman can be installed in two different ways,
- As a Standalone application
- As Chrome extension
But the most recommended one for installation is as a “Standalone application”.
POSTMAN GET and POST Request
Postman is lightweight and easy to use offers a very user-friendly interface with many features. Next, we are going to learn to create a GET request and POST request in Postman.
Creating New GET Request
- A new request can be created by clicking the “New” option from the header or by clicking “Request” option from the popup.
- In the “Save request”popup, enter the request name and the description for which the request is created.
- Enter the Collection name in which the requests need to belong and click “+Create Collection” option then Save. The below snapshot shows the save collection.
- Select the created request can be viewed from the Collection in the sidebar.
- By default, the request which you enter will be a GET request and specify the URL for ‘GET’ request then click the ‘Send’ button.
- Select the created request can be viewed from the Collection in the sidebar.
- By default, the request which you enter will be a GET request and specify the URL for ‘GET’ request then click the ‘Send’ button.
Our first GET request is created and the response for the created request can be seen in Pretty, Raw and Preview formats.
In Pretty format, the content will be in a readable format with colored keywords. Raw format is the same as pretty without any colorful keywords and Preview shows the response preview of the browser.
Creating a POST Request
If you are about to use a sensitive information then POST request is preferred. Unlike ‘GET’ request POST request involves the addition, deletion, and update of information to the server.
- In the request, select the request method POST and enter the URL.
- Click Body tab for adding additional information for our POST request.
- We have to send the additional information in the correct format in which the server expects so click Raw and select the format type as JSON (format type varies based on the request which we send).
- Enter the below information in the JSON body and press send.
{
“FirstName” : ”William”,
“LastName” : “James”,
“Password” : “admin”,
“Email” : “admin@123”
}
You will receive the response as 201 Created as you have added a new record through POST request.
There are many methods available to send the data through POST request and the above method is one among them.
API testing helps you to ensure the APIs of the application is robust and quality delivery.
References:
https://www.mulesoft.com/resources/api/what-is-an-api
https://blog.restcase.com/why-api-testing-is-important-in-your-development-process/
http://toolsqa.com/postman-tutorial/
https://www.guru99.com/webservice-testing-beginner-guide.html
Smarter Test Management For QA Teams
Free up to 300 Test Cases. No credit card required
Sign up for free