Blog / Basic API Test Automation with Postman

Basic API Test Automation with Postman

Numerous API testing tools offer manual and automated test development. Perhaps the most popular tool is Postman, which offers a free version along with a high-quality set of online tutorials and support information for API testing.

The example steps below cover the basics of creating an API request test and identify the sections to review.

Quick Postman tutorial

To get started, download the desktop version or use the online version. Set up an account, and create a Workspace.

Once you have a Workspace, you’re ready to start creating requests for testing. Select the HTTP Request option. For each new request, Postman opens a new tab labeled “Untitled Request.” Always set a title that summarizes the test objective and API for easier test identification.

Once you have set a title, then choose GET, POST or PUT and enter the API endpoint URL. Set any known parameters and authorization headers, then choose a body type and set the request data.

You’ll know if the API requires parameters or only a body, or security information within the authorization header based on the API’s documentation. Most API documentation also includes a sample request body to copy or use for reference.


Testing in Two Days

For software testers, it’s always crunch time. Striking the balance between effective and expedient testing isn’t always easy, but it’s necessary in our fast-moving digital world.

View the sample request in the screenshot above. Notice the request tab displays the name, method (GET) and the endpoint URL from my API documentation. Postman will automatically add the necessary headers based on the API.

If the API requires security authorization, you’ll need the authentication credentials and the security type to generate a valid security token. Most organizations keep API security tokens available through the API developer or an IT manager.

Our test request is ready to go. Select the Send button. Review the example below. After you send the request, the response populates in the lower half of the window. The best format is JSON, but the format is determined by the API so choose the one you need. Notice there is additional information to the right including the response status code.

To create test automation from a request, get started by selecting the Tests tab, which displays on the same line as Params and Authentication. View the code snippets on the right side to create automated API tests. Every time a request is sent, the automated tests execute and automatically populate the Test Results tab.

In this example, I used two code snippets but only edited the first, so it displays as passed. The second one fails because it was not updated to match the API requirements. Testers must always edit the code snippet to match the API’s expected response data. Postman provides detailed support information and training.

Ultimately, API testing is an excellent way to evaluate the back-end infrastructure. Testing APIs is beneficial for customers as well as internal developers and users to ensure continued functionality post-release as well as during development cycles. Give your product an edge by investing in API testing.


The Essential Guide to Crowdtesting

Get the facts about crowdsourced software testing. In this guide, you'll learn how leading brands across industries deliver better quality releases, at speed and scale.

Read 'The Essential Guide to Crowdtesting' Now
Published: September 7, 2023
Reading time: 5 min

5 Threats to Streaming Content Protection

Protect streaming media revenue against its many emerging threats

Why Retail Digital Quality Matters More Than Ever 2

Against a challenging economic backdrop, our 2023 State of Digital Quality in Retail report highlights global retail testing data trends and how retailers can successfully address their quality issues

‘Tis The Season: What Shoppers Want in Winter 2023

In October 2023, Applause conducted its annual holiday shopping survey to gather research on consumer trends ahead of the festive season.

Make Every Day World Usability Day

Take time today to consider how well your digital experiences serve different audiences

Get Ready for the European Accessibility Act

Read the highlights from our recent webinar on how to prepare for the new law

Crowdsourced Software Testing FAQs

We answer some common questions about crowdtesting