Select Page
Blog - Designing and Testing APIs to Work Over the Long Run

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 GETPOST 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.

Podcasts

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.

Postman displays the keys and values for the query. The API response populates in the lower half of the window — JSON is the format in this example.
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.

The Tests tab of the Postman workspace is highlighted. Options for Script with Postbot are displayed to enable the user to execute automated tests.
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.

eBook

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.

Want to see more like this?
Published: September 7, 2023
Reading Time: 7 min

Software Testing Basics: Automated Functional Testing FAQs

Learn more about how automated testing fits into a comprehensive digital quality program.

4 Test Automation Limitations to Overcome

The limitations of test automation in DevOps organizations, and how it can leave some problematic — and costly — digital quality blind spots.

Improving Digital Quality with Community-Based Test Automation

How do you increase the speed of quality to keep pace with shorter timelines and faster release cycles?

Manual and Automated API Testing Options

Familiarize yourself with APIs and how to test them

What Is Regression Testing? Types, Approach and More

Make sure new features don’t break existing functionality

JavaScript SDK Enables Test Automation Across OTT Platforms

Unlock the power of the world’s most popular programming language
No results found.