![]() The first request we’re going to create in Postman is the GET request for finding pets by status. Ĭreate collection variable Create GET request and test for it ![]() Populate “ Variable name”, “Initial value” and “Current value” columns with respective values: baseUrl and.In the collection’s view, select “Variables” tab.Select the collection in “Collections” tab.Since the base URL is the same for every API request, it makes sense that we store it as a variable in our collection so that we can reuse it. In the documentation, the base URL of the API is written as: /v2. The documentation for Petstore API is available here. Exploring the documentation will give you a clear overview of the API, what is expected in each request, and what response you will receive for it. I’d also like to encourage you to take the time to explore the documentation, if available, for every API you use. I will use the Petstore API from Swagger for the examples. Postman collection structure Practical examples using Postman Namely, when we want to chain multiple API requests to test, for example, if the data in one endpoint is present in the other related endpoint. An Integration tests folder can also be created where we can place API tests that test the connection between different API endpoints.The name of the folder is usually the name of the endpoint. Folders are created for every endpoint. ![]() It is up to you to decide how you would like to structure the collection, however, the most common practice is that: Inside it we can organize our work in folders and subfolders. This means that the collection is a root folder of our project. Workspace - the overview screen of Postman How to structure a collection in PostmanĪs mentioned above, we group all API requests in a collection, but we also group our API tests in a collection. Collection is a group of saved API requests, while environments is a set of variables that we can use in the requests. Inside our workspace we can access collections, environments, mock servers, monitors and other Postman features. Workspaces help us organize our API work and collaborate with teams across the organization. ![]() Postman’s central view is the workspace where all the things we’re going to use are positioned. To use the desktop app, you don’t have to be a registered user, however, not all features will be available. If you don’t want to install the app, Postman offers a web version as well, but to access it you have to create a Postman account first-if you don’t have one already. If you’re using macOS, make sure to download Postman for the correct chip under which your laptop is running. You should be able to select the correct operating system. Postman installation and user registration Postman has over 20 million registered users as of today. Postman can store and manage API specifications, documentation, workflow recipes, test cases and results, metrics, and everything else related to APIs. As a result, teams in an organization can create better APIs in an easier and faster manner.Īt its core, Postman allows users to easily store, catalog, and collaborate around all API artifacts on one central platform. It simplifies each step of the API lifecycle and streamlines collaboration. Postman is an API platform for engineers to design, build, and test their APIs. What is Postman?Ībhinav Asthana, a software engineer who wanted to simplify API testing, started Postman as a side project in 2012. If not, then I highly recommend reading one of my previous articles- Understanding APIs: Simplified Guide for Beginners, before proceeding with this one. I assume that you’re already familiar with the API concept and understand the basics. I will provide screenshots of practical examples in Postman using a test API. My aim in the blog post is to introduce Postman as a useful tool for API semi-automated testing.
0 Comments
Leave a Reply. |