Webservices/API Testing FAQ’s Part-2 Postman


19. What is Postman?
  • Postman is a rest client software that started as an chrome extension but is now available as native application also.
  • 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.  
20. 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  because we can rely on the same 64 characters in any encoding language that we use.
21.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.
22. 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.
23. 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.
  • 24. 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.
25. 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.
26. Describe any four response things you receive from a response
  • 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
27.What is a collection in Postman?
  • A collection in Postman is similar to a folder in your system.
  • A collection is the grouping of requests, 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.
  • 28.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.
29.State any 5 types of Request Method types.
  • Get
  • Post
  • Put
  • Delete
  • Patch
  • Head
  • Delete
30. 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.
31. What are different types by which we can see response body in Postman.
  • 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 colors which is easy to read and analyze the response. It is just like any good text editor used for coding.
32. 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.
33.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.
34.What is Pre-Request Script in Postman?
  • A pre request script is a script that runs before the execution of a request.
35.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.
36.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.
37.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.
38.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;
39.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.
40.What are the two types of scripts in Postman?
  • We can write two types of script in Postman
  • Tests script
  • Pre-request script
41.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.
42.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 –folder

Followers