Thursday, June 6, 2024

API Testing Using Postman: Part 4

 Here we are validating 5 types of response in the output.
  1. Status code
  2. Headers
  3. Cookies
  4. Response time
  5. Response body
  • To test the above validations we have something called "Assertions" in Postman. Assertion is nothing but a validation point. To add this validation we have one library in Postman called "pm".In this, we have so many functions available. By adding some parameters to these functions we can validate the above responses.
Testing Headers:
  • We can check static values present in the header.
  • We are checking whether the text is present in the header as well as the text assigned to the header.
Testing Cookies:
  • Every time, the cookies we get are not constant. So we are using two types of assertions. One is to check whether that cookie is present and another is text present for that cookie.
Testing Response time:
  • We are checking whether the API is running in the expected time. we don't know the exact time every time, So we are giving min or max time to validate the time.
Testing Response body:
  • Sometimes the response in the body is not static values, it will be dynamic sometimes. So, we are validating only the static values or content in the response body.
validating the Response body in 3 categories.
  1. Validating the type of values.
  2. Validating the values assigned.
  3. Validating JSON Schema.

No comments:

Post a Comment