Top 25 Postman Interview Questions & Answers

1) What is Postman?

Postman is an API(application programming interface) development tool which helps to build, test and modify APIs.

2) Why should we use Postman?

– Postman is a free tool.
– Postman has the ability to make various types of HTTP requests(GET, POST, PUT, PATCH), saving environments for later use, converting the API to code for various languages(like JavaScript, Python).
– Postman manages end-to-end API lifecycle, from design, mocking, testing, and deploying, all the way to maintenance and deprecation.
– Postman’s Platform Runtime Service can manage API collections, workspaces, examples and environments.
– Postman can be easily integrated with CI/CD tools like Jenkins.
– Postman provides extensive documentation and widely supported by the community.

3) What are the different types of variable scopes available in Postman?.

Postman provides the following environment variable scopes:
– Global Variables: It allow you to access data between collections, requests, test scripts, and environments. Global variables are available throughout a workspace.
– Envrionment Variables: It allows you to tailor your processing to different environments, for example local development vs testing or production.
– Local Variables: They are temporary, and only accessible in your request scripts. Local variable values are scoped to a single request or collection run, and are no longer available when the run is complete.
– Collection Variables: are available throughout the requests in a collection and are independent of environments, so do not change based on the selected environment.
– Data Variables: come from external CSV and JSON files to define data sets you can use when running collections via Newman or the Collection Runner.

4) What is the order of preference scope for each Postman variable?

If a variable with the same name is declared in two different scopes, the value stored in the variable with narrowest scope will be used. Below is the preference of the variables in descending order Local Variables -> Data Variables -> Environment Variables -> Collection Variables -> Global Variables

5) How can you log the variable value in Postman?

Variable values can be logged in the Postman console by using the following command:
console.log(pm.variables.get(“variable_key”));

6) What is a dynamic variable and how can you use it in Postman?

Postman provides more than 100 dynamic variables which can generate unique random values. Some of the examples are:
{{$guid}} : A v4 style guid
{{$timestamp}}: The current timestamp (Unix timestamp in seconds)
{{$randomInt}}: A random integer between 0 and 1000

We can use dynamic variables in pre-request script or test scripts using the following script:
pm.variables.replaceIn(‘{{$randomEmail}}’);

7) What are the different authorization options available in Postman?

API Requests can be authorized using the following options:
– API Key
– Bearer Token
– Basic auth
– Digest auth
– Oauth 1.0
– Oauth 2.0
– Hawk Authentication
– AWS Signature
– NTLM Authentication

8) How can you reuse your authentication token for different requests?

We can create a Collection and add all the requests to that collection. We can add the authorization token
in the collection and then we can select “Inherit auth from parent” option as authorization for every request.

9) What are the types of API Requests which is supported by Postman?

GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, UNLINK, PURGE, LOCK, UNLOCK, PROPFIND and VIEW.

10) What is difference between Query Params and Path Variables?

Path Variables is used to identify a specific resource or resources whereas Query Parameter is used to sort/filter those resources.

11) What is a Collection in Postman?

We can group requests into collections to keep your workspace organized, to collaborate with teammates, to generate API documentation, test suites, and to automate request runs.

12) Write test code to check whether the response status is 200 or not?

pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});

13) In which type of encoding does postman accept authorization credentials?

Postman accept authorization in Base64 encoding only. This is provided inbuilt in Postman or else you can also refer third party websites to convert the credentials in base64.

14) Can we have two global scope variables with the same name in Postman?

Since global variables have global scope i.e. without any environment, they cannot have duplicate names.

15) What is a workspace in Postman?

Workspaces allow us to organize our Postman work and collaborate with teammates. We can group our projects together, with workspace acting as the single source of truth for related APIs, collections, environments, mocks, monitors, and other linked entities.

16) How many types of workspaces are present in Postman?

There are 2 types of workspaces in Postman:
– Personal Workspace: This workspace is only visible to the account user
– Team Workspace: This workspace can be accessed and shared across the team members

17) Can we import local variables in Postman Monitors?

Yes. Postman monitors allows to import local variables but it does not allow to import global variables.

18) What is binary in Post method in Postman?

Binary form in Postman is designed to send the information in a format that cannot be entered manually. Since everything in a computer is converted to binary, we use these options which cannot be written manually such as an image, a file etc.

19) What are the two types of scripts in Postman?
We can write two types of script in Postman:
– Tests script
– Pre-request script

20) How can Postman collections run through the command line?

Postman collections can be directly run from the command line using the Newman tool. Newman is a nodejs based package, which requires just a node environment to execute the collection and has full parity with the Postman collection runner i.e. the Newman collection runner supports the Postman capabilities like Running assertions, Pre-request scripts or any other scripts that are associated with the requests that are a part of the collection.

21) Which one will be preferred in postman- a global variable or a local variable?

In postman, if 2 variables have the same name( one being local, other global) then the higher priority is of the local variable. it will overwrite the global variable.

22) What is a Collection Runner?

Collection Runner is used to run set of requests in a specified sequence and environment. We can also use external data files to run the requests in multiple iterations. Collection Runner logs all the request test results and scripts can pass data between requests.

23) How can you monitor APIs in Postman?

We can use Collection Monitors to schedule and monitor all the APIs in a collection. Postman will send a email notification for every API Request/Test failure.

24) Which BDD library is used to assert values inside Postman tests?

Chai assertion library is used in Postman tests. It provides many language chains which are used to build assertions within the API Tests.

25) What is a Pre-Request script?

We can use pre-request scripts to execute JavaScript before a request runs. We can perform pre-processing tasks
such as setting variable value, parameters, headers and body-data.

 

WATCH OUR YOUTUBE VIDEO PLAYLIST TO LEARN POSTMAN:

 

 

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

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

error: Content is protected !!