In modern application development, Web API is an important part of an application. It helps develop various applications on different platforms with the same back-end logic, such as - in a banking application, we get the same options in the Internet Banking (Website) and Mobile Banking (app) with their same functionality on different application platforms.

In this article, we will learn how to store values in environment variables and how to use them.

Prerequisites

Practical

Syntax

  1. postman.setEnvironmentVariable("<key>", "<value>");
  2. postman.setEnvironmentVariable("username", "vivek");
  3. postman.setEnvironmentVariable("password", "pass");
  4. postman.setEnvironmentVariable("grant_type", "password");

This will create the environment variables.

  1. username={{username}}&password={{password}}&grant_type={{grant_type}}
Web API Automation Testing Using Postman

In the next article, we will see some more techniques to test the data using Postman automation.