Search Bar

How to do testing on REST APIs using POSTMAN application?


How to do testing using the POSTMAN application?


In this tutorial, we are going to see how we can use the POSTMAN application for testing REST APIs.

What is the POSTMAN App?

Postman is an API testing tool that connects quickly to a CI / CD pipeline. It started in 2012 as a separate project by Abhinav Asthana to simplify the workflow of the API in testing and development. API stands for Application Programming Interface that allows software applications to communicate via API calls.

Why do we use the POSTMAN App? 

With over 4 million users today, Postman Software has become a tool of choice for the following reasons:

1. Accessibility - Using the Postman tool, a person will automatically need to log into his or her accounts making it easy to access files at any time, as long as the Postman program is installed on a computer.

2. Use of Collections - Postman allows users to create collections of their Postman API calls. Each collection can create subfolders with multiple applications. This helps to organize your test sites.

3. Collaboration - Collections and locations can be imported or exported making it easy to share files. The direct link can be used to share collections.

4. Creating a Place - Having multiple locations helps with a small amount of testing as one can use the same collection but in a different location. This is where parameterization will take place which we will discuss in other studies.

5. Test Creation - Experimental test sites such as ensuring effective HTTP response status can be added to individual Postman API calls that help ensure test coverage.

6. Automatic Testing - With the use of Collection Runner or Newman, tests can be performed with multiple repetitions that save time for repeated testing.

7. Debug fix - The Postman console helps check which data is restored which makes it easier to fix tests.
Continuous integration - With its ability to support continuous integration, development processes are maintained.

How to download and install the POSTMAN application? -

Being an open-source tool, Postman can be easily downloaded. Here are I am showing the steps to install:

Step 1) Download the POSTMAN:-
Go to https://www.postman.com/downloads/ and choose your favorite platform between Mac, Windows, or Linux. Click Download.

How to do testing on REST APIs using POSTMAN application

How to install the POSTMAN:-
Step 2) Click on Run:-
Your download is in progress and the message should now appear on the Apps page. When the Postman download is complete, click Run.

Step 3) Start the POSTMAN Installation:-
Wait a while to complete the POSTMAN Installation.

How to do testing on REST APIs using POSTMAN application
Step 4) Click Save My Favorites.
Select the workspace tools you need and click Save My Favorites.

Step 5) Congratulations!
You will see the Getting Started Screen.
How to do testing on REST APIs using POSTMAN application

How to use POSTMAN for testing or executing REST or SOUP APIs?

Below is Postman Workspace. Let’s take a look at the step-by-step process of How to Use Postman and the different features of the Postman tool!

How to do testing on REST APIs using POSTMAN application
1. New - This is where you will create a new application, collection, or location.

2. Import - This is used to import a collection or location. There are options such as importing from a file, folder, link, or pasting raw text.

3. Runner - Automatic testing can be done using Group Runner.

4. Open New - Open a new tab, Post Person window, or Run Window by clicking this button.

5. My Workplace - You can create a new workspace individually or as a group.

6. Invite - Participate in a workshop by inviting team members.

7. History - Past requests that you submit will be displayed in History. This makes it easy to track your actions.

8. Collections - Organize your test site by creating collections. Each collection may have several folders and multiple applications. The request or folder can also be duplicated.

9. Application tab - This shows the title of the application you are working on. By default, the "Topless Request" will be displayed with titles without titles.

10. HTTP Request - Clicking this will show a drop-down list of various applications such as GET, POST, COPY, DELETE, etc. In the Postman API test, the most used applications are GET and POST requests.

11. Request URL - Also known as an endpoint, is where you will point the link to which the API will link.

12. Save - If there are any changes to the application, click save is required so that new changes are not lost or overwritten.

13. Parameters - This is where you will write the required parameters for the application such as value values.

14. Authorization - To access APIs, proper authorization is required. It can be in the form of a username and password, manager token, etc.

15. Topics - You can set topics like JSON content type depending on organization needs.

16. Body - This is where one can create custom information on a request that is commonly used in POST requests.

17. Previous application script - These are scripts that will be written before the application. Typically, previous application location setting documents are used to ensure that tests will be performed in the appropriate location.

18. Tests - These are scripts created during the application. It is important to have a test as it sets the test areas to ensure that the response status is correct, the returned data as expected, and other tests.

Working with the GET API Requests- 


Recovery requests are used to retrieve information from the given URL. There will be no changes to the storage location.

We will use the following URL for all examples in this Postman course.


let's go to the workplace.
Step 1. Change or Set your HTTP request to GET from the dropdown box.
Step 2. In the Application URL field, the installation link.
Step 3. Click on the Send button.
Step 4. You will receive 200 OK Messages.
Step 5. There should be 10 user results in the body that indicate that your test has worked successfully.

How to do testing on REST APIs using POSTMAN application

NOTE: There may be situations where the Request for Postman request is unsuccessful. It may be due to an invalid request URL or verification.

Working with the POST API Requests:- 

thePOST API requests are different from the GET API Request as there is data manipulation when the user adds data at the end. We are using the same data in a previous study for GET API Request, now let's add our own user.

Step 1) Click the new tab to create a new application.
Working with POST requests.

Step 2) On the new tab.

i) Set POST HTTP request to SEND.
ii) Enter the same link in the application URL: https://jsonplaceholder.typicode.com/users
iii) Switch to the Body tab.
Working with POST requests.
Step 3) In the body,

i) Click the raw.
ii) Select the JSON.
Working with POST requests.

Step 4) Copy and paste one user result from the previous retrieval request as below. Make sure the code is copied correctly with parentheses and folded brackets. Change id to 11 and name whatever you want. You can also change some details to an address.
[ { "id": 11, "name": "Krishna Rungta", "username": "Bret", "email": "Sincere@april.biz", "address": { "street": "Kulas Light", "suite": "Apt. 556", "city": "Gwenborough", "zipcode": "92998-3874", "geo": { "lat": "-37.3159", "lng": "81.1496" } }, "phone": "1-770-736-8031 x56442", "website": "hildegard.org", "company": { "name": "Romaguera-Crona", "catchPhrase": "Multi-layered client-server neural-net", "bs": "harness real-time e-markets" } } ]

How to do testing on REST APIs using POSTMAN application
* Note: The Online Post application must have the correct format to ensure that the requested data will be processed. It is a good practice to use Get First to check the JSON application format. You can use the same tools https://jsonformatter.curiousconcept.com/


Step 5) Next,

i) Click on the Send button.
ii) Status: 201 Created should be displayed
iii) Posted data are showing up in the body.

How to do testing on REST APIs using POSTMAN application



Post a Comment

0 Comments