
If the mimeType property is nested inside another object named profilePhoto, we should use a little bit more complex script structure.

In the test below (image 5) we have already verified that we have an email property and a mimeType property. In the next couple tests, we will be working closely with the response data (image 4). Checking data type of the response Checking Properties It can be helpful when we definitely know what data type some property value should have and any other data type in response would cause errors in the application. We can also use tests to verify the data type of any part of a response. For example, we can write a separate branch in tests with the purpose of verifying that an unauthorized user will only get 401 status code response from the API on all of his requests. If you want to, you can also test for any other response codes used in APIs, like 200, 401 or 500, and pass or fail the test based on what’s expected. If the response code is a 200, the test will pass, otherwise it will fail. Now let’s create a simple test that will help us check the response code returned by an API. Maybe it’s an obvious step, but without it, our next tests will not be authenticated, and none of the rest will work as expected. Before we can write a script, we will need to save the authorization token we grabbed from the real application and store it as an environment variable. To get started writing test scripts, use the Tests tab in Postman. Using Test Scripts Creating a Test, Extracting the Token Let’s show some specific examples that Trailhead are currently using in our projects.

Tests srcripts are launched immediately after Postman receives a response from an API, and all further interaction depends on the scripts and their assertions. The main tool that we will use for automation in Postman is test scripts, which can either be written from scratch in JavaScript, or edited from ready-made snippets to suit your needs.
POSTMAN TEST API HOW TO
In this blog post, I will talk in more detail about how to do automating API testing in Postman, and show you some real-life examples of how you can use it yourself. Postman is probably the most popular tool for testing APIs. When automation permeates our processes, it often serves our ultimate goal of saving our valuable time for other things that humans are better at.
POSTMAN TEST API SOFTWARE
In the world of modern software development and testing, the word “automation” has become a familiar one, and for good reason.
