We have learnt Postman in great detail now. The details of the topics we have completed can be viewed here. Since we have completed so much and adding your own practice hours, it is time we practice some interview questions on Postman. We have discussed the most important Postman Interview Questions here without giving too much in detail since we have already described everything in the course. I hope this will prove fruitful for your career.
Postman Interview Questions
What is Postman?
Postman is a rest client software that started as an chrome extension but is now available as native application only. Postman is basically used for API testing in which you can test your APIs with different types of request method types like post, put etc and parameters, headers and cookies. Apart from setting the query parameters and checking the response, postman also let us see different response stats like time, status, headers, cookies etc. with some extra excellent features that can be used with ease.
What is an API?
API stands for Application Programming Interface. Talking in technical terms an API is a set of procedures, functions, and other points of access which an application, an operating system, a library etc., makes available to programmers in order to allow it to interact with other software. It can be considered as the waiter which acts as the middleman between your requests and the chef. Similarly API refers as the middleman between a client and a server. (Refer tutorial)
What are some tools used for API Testing?
There are many API testing tools. The following six are the top most according to the users/downloads. These are not the rankings though.
- Postman
- SoapUI
- Katalon Studio
- Tricentis Tosca
- Apigee
- Jmeter
In which type of encoding does postman accept authorization credentials? Why?
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. We use base64 particularly because it transmits the data into textual form and send it in easier form such as HTML form data. We use Base64 particularly because we can rely on the same 64 characters in any encoding language that we use. (Refer tutorial)
What is meant by the term Environment with respect to Postman?
An environment in Postman is a set of key-value pairs. You can create multiple env in postman which can be switched quickly with a press of a button. There are two types of environment, global and local. They define the scope of the variable to use it in the requests. Most commonly the variable is defined inside the environment for the same purpose. The most common variable we use is url because url is used in every requests and changing it can be very time consuming. When we create an environment inside Postman, we can change the value of the key value pairs and the changes are reflected in our requests. An environment just provides boundaries to variables. (Refer tutorial)
Can we have two global scope variables with the same name in Postman?
Since global variables are global i.e. without any environment, they cannot have duplicate names as it creates confusion for the software. Local variables can have same name but in different environments. (Refer tutorial)
Which one has the higher priority in Postman? A global variable or a local variable?
In Postman, if two variables have same name (one being local and one being global) then the higher priority is of the local variable. It will overwrite the global variable. (Refer tutorial)
Define Team workspace in Postman
A workspace is a collaborative environment for a group of users to develop and test APIs. A team workspace is a workspace which is shared by the whole team working on same collections of requests. Since it is very time consuming and hard to share the collections through external drives or other sharing means, team workspace synchronises and collaborates all the team's work at one place. (Refer tutorial)
Explain the following piece of test code in Postman
tests[“Status Code is 200”] = responseCode.code === 200
- tests - variable on one of type array
- Status code is 200 - A string or the test name which will be represented in the test result box so that we can know what test was it. It is important as we use many tests on one request.
- responseCode.code = responseCode is used to save all the response that we get from the server. Since we do not need complete response, we need to create one object to extract our required info. code object is then called to output the status code (like 200) from the entire response which we have saved. (Refer tutorial)
What is the difference between Postman Monitors and Postman Collection Runner?
The postman Monitor is an automated way of running collections. Collections are triggered automatically as per specified parameters whereas Postman Collections require some manual effort to start and monitor the execution. A postman collection runner runs the collection for the iterations you want to. It will be stopped when you stop the software and is not automated. A postman monitor will run your collection at regular user defined intervals till the time you have specified. Your collection will be run even if your system has shut down as it is connected through postman cloud. (Refer tutorial)
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. I believe it can be imported in json, if yes, pls mention.(Refer tutorial)
Describe any four response things you receive from a response (Correct or Incorrect)
- Status Code
- Response Status
- Response time
- Response Size
- Response Headers
- Response Cookies
- Response Date and Time
- Response Session limit
- Response Cookies
- Response Server
- Response type
(Refer Tutorial)
What is a collection in Postman?
A collection in Postman can be imagined similar to a folder in your system. A collection is the grouping of requests, preferably of the similar types. It can be compared similar to the folder inside your system which has one type of files. It is one of the most vital feature of Postman and it also provides nice features such as running a whole group of request together with just one click. A collection is also important for sharing many requests at once and contains many more features which can be referred by the given link. (Refer tutorial)
Should we save our work in Postman cloud if we are working in a company? Why?
A Postman cloud is Postman company's repository like Microsoft has One Drive etc. In Postman cloud you can save your work instantly after logging in and also retrieve it from anywhere you want. It is not preferred to save your work in Postman cloud as company's work is often confidential and should not be leaked out. Postman cloud needs signing in and hence security can be compromised, therefore team workspace is preferred instead of saving the work in Postman Cloud. (Refer tutorial)
State any 5 types of Request Method types.
- Get
- Post
- Put
- Delete
- Patch
- Head
- Delete
(Refer Tutorial)
Please define status code 401. Also, a situation in which we can incur such status code.
Status code 401 is referred for an unauthorized request. An unauthorized request is a request for which you are not authorized. We can incur such a status code when you are not authorized to access the server or you have entered wrong credentials.
Other status codes which are seen commonly are
- 200 (OK) : Defines that the request was correct.
- 201 (Created) : The value wrapped with the request has been created in the database. It is needless to say that the request was correct.
- 204(No Content) : This status code means that the request was correct and received but there is no response to send to the client by the server.
- 400 (Bad Request) : A bad request means that the syntax of the request was incorrect. It can happen if you have sent wrong parameters along with the request url or in the body of the request.
- 404 (Not Found) : A response code 404 means that the server was connected but it could not find what was requested. You can normally see this status code when you request a web page which is not available.
(Refer tutorial)
What are different types by which we can see response body in Postman. Explain.
In Postman, a response body can be seen by three different types
- Pretty
- Raw
- Preview
Although all the three have their own importance and value in Postman, the most commonly used is Pretty as it shows the response code in different format and colours which is easy to read and analyse the response. It is just like any good text editor used for coding. (Refer tutorial)
What is "Bulk Edit" feature of Postman used for?
Bulk Edit feature of Postman is used for the convenience of adding parameters to a new request from the previous request. Since a request can have many parameters and it is very difficult to copy and paste one by one, bulk edit feature helps us copy all the keys and their respective values at once and paste them. (Refer tutorial)
What is "x-www-urlencoded" in Post method in Postman?
Form data and x-www-form-urlencoded are very similar. They both are used for almost the same purposes. But the difference between the form data and x-www-form-urlencoded is that the url will be encoded when sent through x-www-form-urlencoded. Encoded means the data which is sent will be encoded to different characters so that it is unrecognizable even if it is under attack. (Refer tutorial)
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. (Refer tutorial)
What is Pre-Request Script in Postman?
A pre request script is a script that runs before the execution of a request. (Refer tutorial)
What is the difference between authorization and authentication?
Authentication is a process of presenting your credentials to the system and the system validating your credentials. These credentials tell the system about who you are. Authorization is a process of allowing or denying someone from accessing something, once authentication is done. (Refer tutorial)
What are the different scopes of an environment variable in Postman?
A scope of a variable is defined as the boundaries through which it can accessed. They are
- Local Scope : Can be accessed only in the environment in which it was created
- Global Scope: Can be accessed globally in any environment or no environment.
(Refer tutorial)
Why do we group requests under collections when collection is already a grouping of requests?
A collection may have hundreds of requests under it. We need to sub categorize the requests according to a more specific category so that it is easier for us to find them, edit them or modify them. For this we use folders in collections. A collection may have many folders inside it and a folder may have many requests. This way we can generalise the types of requests to a deeper level than the collections which is already generalised. For easiness, a collection can be considered a folder "Movies" in your system which has all the movies. A folder can be considered as different folders inside "Movies" like Hollywood, Bollywood etc which have respective types of movies.
(Refer tutorial)
What are the two ways in which tests can be written in Postman?
In postman we can write tests in either Javascript method or Functional method. Although functional method also uses javascript but the syntax is different. Functional method is officially recommended and used method in Postman. It can also be noticed that all the snippets inside Postman are in functional methods only. It also has an inbuilt library which is Chai. Chai also uses functional method in a very beautiful way to make it more readable and shorter.(Refer tutorial)
Which method should you prefer? Javascript or Functional to write the tests?
It is advised and recommended to use the functional method while writing tests in Postman. Although there have been no notice of ending the support for JS method. (Refer tutorial)
Write a test code to check whether the response status is 200 or not.
A test code to check whether the response status is 200 or not is as follows
tests[“Status Code is 200”] = responseCode.code === 200;
What is the need to Monitor the collections in Postman?
It is very important that your API’s responses and performance remain up to the mark throughout the day. Monitors can help you schedule a collection of test runs to monitor the performance and response of your APIs een if you are not available or not handling them. (Refer tutorial)
Can we run monitors in Postman without Signing in?
No, monitors cannot be run without signing in because monitors run your collection even if your system is shut down. So, you need a place to store the collection and let it run automatically. You also need a place to store the reports so that you can look at them when you are free. This all needs to be saved into your postman account and hence you need to sign in. (Refer tutorial)
What is the importance of setNextRequest in Postman?
setNextRequest in Postman is used to define the workflow. setNextRequest is needed to change the order of the requests being executed. (Refer [tutorial[(https://toolsqa.com/postman/workflows-in-postman/))
What are the two types of scripts in Postman?
We can write two types of script in Postman
- Tests script
- Pre-request script
(Refer tutorial)
What is Chai Assertion Library?
Chai assertion library is an assertion library which is installed beforehand to use in Postman. This is used to write assertions in Postman which are very beneficial. Chai assertion helps us write many lines of test code in a few lines which is both understandable and readable. Chai uses BDD approach which means that chai library has codes that are more user friendly.
A simple code written in chai library which tests if number 3 is already in array or not.
pm.test(“Number included”, function(){ pm.expect([1,2,3]).to.include(3); });
(Refer tutorial)
What command line interface is used with Postman normally to serve continuous integration.
Newman is used with Postman normally as a command line interface to serve continuous integration. (Refer tutorial)
Write the command for running a folder in Newman.
In Newman it is not necessary to run the complete collection to check just a bunch of request. This is obviously time consuming and not recommended. We can also run just a folder located inside a collection in the Newman. For running a folder in Newman, the following command is used
newman run <collection_name>
–folder <folder name>
(Refer tutorial)
What is Jenkins?
Jenkins is used to build and test your project continuously and hence making the work of a developer and a tester easy for the software. Jenkins uses continuous integration and continuous development for the development and deployment of the software. (Refer tutorial)
In what language is Jenkins written?
Jenkins is an open source automation server written in Java. (Refer tutorial)
What do you understand by continuous delivery?
Continuous delivery works as a next step of continuous integration. Continuous delivery is a DevOps software development practice where code changes are automatically built, tested (Unit Tests), and prepared for a release to an environment. (Refer tutorial)
What is the main difference between continuous delivery and continuous deployment?
The main difference between continuous delivery and continuous deployment is the presence of a manual approval to update to production. With continuous deployment, production deployment happens automatically without explicit approval. (Refer tutorial)
State any 2 advantages of Jenkins.
- It has huge plugin support.
- It is built in Java and hence, platform independent.
- It is an open source tool with great community support
- It is easy to install.
- It is free of cost.
(Refer tutorial)
Why is freestyle job the most preferred job for developers in Jenkins?
A freestyle project is a project in which you can run any types of build. This enables the developers to develop huge number of plugins for this type of projects as it gives flexibility. Also, it let us develop any type of build so it becomes a primitive choice. (Refer tutorial)
Why does plugins not come pre installed in Jenkins?
Plugins are used for extending the features of a software. Since these plugins can be of considerable sizes, it increases the overall size of the software. Moreover, it is quite obvious no one developer will be using all the features in his software. Therefore, plugins do not come pre installed and the developers install themselves whichever plugin they need.
What is the difference in Post-Build and Build with respect to Jenkins?
Build in Jenkins accepts the batch commands that are needed to be executed. For example newman run <link>
is a batch command needed to run a collection through Newman and hence is written in build section.
Post-Build section is used to tell jenkins if there is anything that is needed to be done after the batch commands have been executed. These can include publishing the reports as we publish the report after the commands have executed and tests are run etc. (Refer tutorial)
What flag is used to remove unicode from the Jenkins console output?
A flag is used in Jenkins to make some changes in the output console. A flag also provide option so that the complete response can be filtered out. For removing the unicode we use --disable-unicode flag. (Refer tutorial)
Why do we require Reports in Jenkins?
A report in Jenkins is a structured and graphical way where we can see the execution results or test output. Reports also work easier when we have to communicate the results with our team members or with other stakeholders. It is always convenient to see the complete track of your APIs through a report than comparing the console outputs. (Refer tutorial)
What is the command to generate an junit xml report in Jenkins?
To generate a junit xml report we use --reporters junit command. (Refer tutorial)
What is the difference between --reporters and --reporter flags in Jenkins?
--reporters is used to tell jenkins that we need to publish a report. We then need to specify what type of report we want.
--reporter is used to as an option for additional operations on reports. This is defined by the flags we use after this. For example --reporter-export will export the report to the given location. (Refer tutorial)