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.

Create a new HTTP request.

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.

The API response populates in the field below.

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.

Use Postman test automation functionality.

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
Want to see more like this?
Amy Reichert
Freelance QA SME/Test Engineer
Reading time: 6 min

5 Threats to Streaming Content Protection

Protect streaming media revenue against its many emerging threats

Understanding Generative AI: Answers to Some FAQs

Learn why generative AI’s popularity has skyrocketed, what makes it so special, and how to develop trustworthy genAI apps with these frequently asked questions.

Some Key Considerations for Testing Blockchain

Blockchain technology is changing the ways people think about — and process — secure transactions across different sectors. Transparency and testing are crucial in helping people trust the results. Explore some use cases and quality considerations.

Generative AI Use Is Growing – Along With Concerns About Bias

See the results of Applause’s survey on generative AI use and user sentiment

How to Land Your Dream Software Testing Job

Here’s how to stand out in a competitive yet thriving QA job market

What Is Continuous Testing in DevOps?

Learn about continuous testing benefits, tools and frameworks