Skip to content

The repo contains my practice towards API Testing using Postman and have attached relevant data indicating the Test results during the practice phase.

Notifications You must be signed in to change notification settings

ss-shrishi2000/Postman_API_Testing_Scripts_And_Validations

Repository files navigation

Postman_API_Testing_Scripts_And_Validations

Testing API Response Codes:

postman_01

postman_02

Testing API Headers:

  1. There is a lot of information present in the Headers section but our testing should be testing the "Content-Type".
  2. Majorily, what does the "Content-Type" section represent Response Format => JSON, XML, HTML, etc. The format can be (let's say): application/json; which is termed as "mime type". The type of response/data is called mime-type.
  3. So, we need to verify if the content type is in JSON Format or not.
  4. We can also perform validation on the "Connection" field.
  5. We can also perform validation on the "Expires" field.

postman_03

Testing Cookies:

  1. One issue of testing the cookies is that they are prone to change dynamically or their values keep on changing.

  2. But there are some cookies whose value won't change each time dynamically. So we can validate those cookies.

  3. Assertion => pm.expect(pm.cookies.has('language')).to.be.true;

  4. Assertion => pm.expect(pm.cookies.get('language')).to.eql('en-gb');

Testing Response times:

  1. As the response time can also vary depending on multiple factors, we try to check if the Response time is under a specified time limit.

postman_04

Testing Response Body:

  1. Asserting if the data types of all fields in the JSON File are correct.

postman_05

  1. Asserting the array properties: Checking if an Array is empty and if it contains particular items:

pm.expect(jsonData.courses).to.include("Java"); pm.expect(jsonData.courses).to.have.members(["Java","Selenium"]);

postman_06

Validating JSON Fields in Response:

  1. The values that are present in the respective fields in Response in the JSON Data file can also be validated: pm.expect(jsonData.id).to.eql(1);

postman_07

Testing the Pre-Request Scripts along with the Test Scripts at the Collection, Folder, and Request Level as well:

postman_08

postman_09

API Chaining Concept:

When we use the Response obtained from an API obtained as a result of some Request sent by the user; as the Request for another/next API; then that is termed as Chaining.

Request1 => API => Response1 => (Response1 = Request2) => Request2 => API2 => Response2

Here; the Response obtained from API1 is sent as a Request for API2

postman_10

About

The repo contains my practice towards API Testing using Postman and have attached relevant data indicating the Test results during the practice phase.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages