Postman Tutorial Part 13 – Create, Manage and Use Environment In Postman

In last post, We have already seen about Understanding on Environment and Global variables. In this post we will see how can we create and access an Environment in Postman.

An Environment in Postman is a set of key-value pairs. The key represents the name of the variable and value is information that key holds.

Steps to create an Environment in Postman:

  1. Click on “Manage Environment” icon at right top corner of Postman tool.

2. You will see below screen:

3. Click on “Add” button. You will see below screen:

4. Give an environment name in “Environment Name” folder. Add a new variable and pass initial value. You will notice that same value given in Initial value will be copied in “Current value” field. “Current value” field keeps the current value of variable.

5. Click on “Add” button. You will see an environment created with named “QA Environment”.

6. You can add/update variable details in existing environment by clicking on its name.

7. Select a created environment in dropdown in workspace.

8. Click on “Environment quick look” (Eye icon). It will show you added variable details.

Accessing variable of Environment:

We can use variables in the request builder which includes the URL, URL parameters, headers, authorization, request body and header presets. We just need to use variable name as placeholder {{variableName}}. This placeholder will be replaced with its current value. For example: – {{URL}} will be replaced by “https://gorest.co.in/ ” from the environment “QA Environment”.

Mouse hover on {{URL}}. You will see all details. See example below:-

Click on “send” button. It will work perfectly.

Important points to be remembered:-

  1. Variable declared in an Environment is local to that environment. You need to select name of the environment first before accessing any variable of it.
  2. You can not select multiple environment names at the same time.
  3. You can not add duplicate variable in same environment but it can be in different environment.

Hope you are clear with creating and accessing environment in Postman. We will see some more about it is upcoming posts.

More about API Testing in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyApiTesting

Leave a Reply

Your email address will not be published. Required fields are marked *