Author - StudySection Post Views - 430 views

Introduction to API Testing

API: API stands for an application programming interface. API is used to communicate and exchange data between two separate software on different platforms over the internet. It is of two types: SOAP(Simple object access protocols ) and REST(Representational state).

API testing is a process that is related to the business logic layer of the software. In this process, we are fully concentrated on the data, not on the look of the application. We use API testing software and get a response instead of the standard user inputs and outputs. A Tester performs API testing, and the application is required to interact with API.

Test cases for API testing:

  1. Verify the return response: This process is related to authenticate the return output according to the given input. Tester submits different types of input and checks the return output.
  2. Check response time: To check the response time of the submitted request for a return response. Response time for a request varies according to the given input.
  3. Verify empty response and improper messages: When there is not any return value according to the submitted request, then check the API behavior for a particular application. An empty response can be handled by giving an alert in the application at the user end.
  4. Unit testing: In the unit testing check the API response for a single operation.
  5. Integration testing: Functional testing check the API response for multiple operations.
  6. Load Testing: Load testing ensures the capability of the Server to handle the expected number of users simultaneously accessing the application.
  7. Security Testing: Security testing is performed to verify the API is secure from all external threats and attacks. We can achieve this process by doing penetration( to detect vulnerabilities of an application from an attacker’s perspective) and fuzz testing( to ensure the security loopholes) to Verify the API is secure.
  8. Invoking event or interrupt: If the response of the API call some event or interrupt the functionality of the application then it should be tracked.

Tools to perform API Testing:

There are various tools available in the market to use for API testing such as the list mentioned below:

  1. Postman
  2. Soap UI
  3. Jmeter
  4. Katalon studio
  5. Apigee
  6. Rest- assured
  7. Assertible
  8. Tricentis

Here we will do API testing using Postman. A postman is an open-source testing tool used for API testing. It is easily available in the market and an individual can also install it as google chrome extension as well in a system according to the system configuration (https://www.getpostman.com/downloads/).

How to use Postman:

Below is a list of the features of Postman:

api-testing-01

  1. New: It is used to create a new request, collection, and environment.
  2. HTTP Request: It is a drop-down field with different request options such as GET, POST, COPY, DELETE, HEAD, LINK, OPTIONS, etc. But the most commonly used request is GET and POST.
  3. Request URL: Here you will enter the URL to communicate with API.
  4. Send: After click on the send button request is submitted.
  5. Params: here you will enter the parameters required for the request such as key values.
  6. Authorization: Sometimes authorization is required to access the API such as Username and a password is required to access the API data.
  7. Headers: Here you can set the headers such as content type according to the requirement of the organization.
  8. Body: It is used to customize the details required in the request. It is commonly used in the POST request.
  9. Pre-request Script: It is used to set the environment for the request and to ensure that the request will be running in the correct environment.
  10. Tests: Test is used to create scripts and to validate the retrieved data from the request.

How to test API using Postman:

Here we will take an example of API with a single user record. To test this we need to follow the below-mentioned steps:

Steps to perform API testing:

  1. Set HTTP Request to GET.
  2. Enter the URL in the Request URL(https://reqres.in/api/users/2)
  3. Click on the send button.
  4. You will see the record of the user in the Body.

Response:

({
"data": {
"id": 2,
"email": "janet.weaver@reqres.in",
"first_name": "Janet",
"last_name": "Weaver",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"
}
})

We get all data according to the sample request.
Screenshot: In the screenshot, we can see the status is 200 and the time taken to the response of the request is 614 ms.
api-testing-02

Knowledge of .NET is quite rewarding in the IT industry. If you have got some skills in the .NET framework then a .NET certification from StudySection can prove to be a good attachment with your resume. You can go for a foundation level certificate as well as an advanced level certificate in the .NET framework.

Leave a Reply

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

fiteesports.com rivierarw.com cratosroyalbet betwoon grandpashabet grandpashabet giriş deneme bonusu veren siteler casino siteleri