MGNK Junction
API testing Interview Questions
What is an environment in Postman?
In postman environment is nothing but set of variables defined, and the variables are stored in the form of key-value pairs which can be used in the postman request. In general, each application might be using different types of server such as development server, staging, testing server and production server. And each server can be accessed with different API end points. Setting up Environments give the ability to customize requests using variables. This way we can easily switch between different environments without changing the requests so that we can quickly change properties of test without the necessity of changing them manually. environments enable us to specify role-based access levels. To group related sets of values together and manage access to shared Postman data with the team, environments are used.
What are the benefits of using environments in Postman?
-
Makes easier to manage the Postman data by grouping related sets of values together
-
Helps to collaborate on API testing projects by allowing to share data with other Postman users.
-
Helps to protect data from unauthorized access by controlling access to shared Postman data
How will you create an environment in Postman?
In the Postman app, click the Environments tab
Click the Add button
Enter a name for the environment
Enter the values for the variables that we want to include in that environment
Click the Save button
Once the environment is created , we can use it in our Postman requests by following these steps:
Open the request that we want to use the environment in
In the Environments section, select the environment that we want to use
The values of the variables in the environment will be populated in the request
Difference between Rest and Soap
REST and SOAP are two different approaches to building and consuming web services
​
​
​
HTTP response status codes
Indicate whether a specific HTTP request has been successfully completed or not
Responses are grouped in five classes
-
Informational Responses (100-199)
-
Successful Responses (200-299)
-
Redirection Responses (300-399)
-
Client error Responses (400-499)
-
Server error Responses (500-599)
What is Payload?
-
In API testing, payload represents the data that is sent to the API endpoint.
-
Payload can be in a variety of formats, such as JSON, XML, or plain text.
-
Payloads are an important part of API testing since it helps to test the functionality of the API in a controlled environment.
-
By using different payloads, we can test the API's ability to handle different types of data and different types of requests. i.e., whether the API can correctly process the data, whether the API can return the correct data, and whether the API can handle errors.
For example, if you are testing an API that returns a list of products,
the payload might be a JSON object that contains the product ID, name, price, and quantity.
You can use this payload to test the API by sending it to the API endpoint and verifying that the API returns the correct product information.
What are the major blockers or challenges faced while performing API testing?
-
Proper Parameter Selection
-
Proper Parameter Combination
-
Knowing which API needs to be called in what sequence
-
Proper knowledge of output verification
-
Knowing what are the proper input values that needs to be provided to the API inputs.
Define Rest API
Rest API - Representational state transfer APIs, known as service endpoints that supports sets of HTTP operations which provide create, retrieve, update or delete access to the resources present in the server.
Authentication: Check whether the user identity is valid or not
Authorization: Check whether the user is allowed to access the resource or not
​
