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.

Monday, June 3, 2024

API Testing Using Postman: Part 3

HTTP vs HTTPS:
  • We have 2 types of URLs. One is HTTP and the other is HTTPS.
  1. HTTP(Hypertext transfer protocol) will give the data to the client without any security(without password encryption).
  2. HTTPS(Hyper Text transfer protocol secure) will give the data to the client with some security (password encryption).

  • URL is divided into 3 parts:
  1. URL: Uniform Resource Locator
  2. URI: Uniform Resource Identifier
  3. URN: Uniform Resource Name


Feature & Resource:
  • The feature is the term which is used in manual Testing to test some functionality. Resource is the term used in API Automation Testing referring to some functionality.
Payload: payload is the body HTTP Request and Response message.
Request payload: In the Request payload, we send the request in the request body using HTTP/HTTPS Request.
Response payload: In the response payload we will get the response in the format of HTTP Response which contains the status code, Response payload and string message.


Thursday, May 23, 2024

API Testing Using Postman: Part 2

  •  API helps to communicate between two different applications and also which are coded in 2 different languages.
  • For example, Google developed maps that contain open-source APIs. Maps are not only used by Google but also by different applications such as whatsapp, FB, snap etc.

  • API vs Webservice: API is a request which will be developed offline without using of public server and Webservice is also an API but it is deployed in the server and made available for the public.
  • All Webservices are API but all APIs are not Webservices.
  • An API is called a Webservice when an API is deployed in a public server and makes it available for everyone.
Two Types of API:
  1. Simple Object Access Protocol(SOAP). (XML format)
  2. REST(Representational State Transfer). (JSON, XML, etc.)
  • SOAP is a very old tool and it is difficult to understand the request and response sometimes.
  • Currently, we are using REST services. we have 4 major commands to request or to get the response.
  1. GET - used to get the requested info from the Database.
  2. POST - used to create a new item in DB.
  3. PUT - used to update the existing item in DB.
  4. DELETE - used to delete existing items from DB.


Friday, May 17, 2024

API Testing Using Postman: Part 1

Client and Server: The client is a computer or local machine which is from the user's end and the server is a place where the data is stored.



Client and server are divided into 3 categories.
  • 1-Tier -  It has only 1 client and 1 server.
  • 2-Tier -  It has multiple clients but contains only one server.
  • 3-Tier -  It will have 3 layers.
           Client(Presentation layer)[multiple clients]
           Business logic(Application layer)[multiple API's]
           Server(Data layer)[Multiple servers]



API - Application Programming Interface.
  •  Application - It works for a Web Application. It is called an Application Layer.
  • Programming - we will send API requests through code which are written in programming languages(Eg: java, python etc.).
  • Interface - It will act as an interface or communication barrier between client and server.


Uses of API Testing:
  • Generally, we test the UI using selenium and we check whether every functionality is working or not. But, when it comes to API Testing we send a request to the server based on the request it will give the response. In the response itself, we can check whether all the functionality is working or not. 80% of the Testing is completed within less time if you know API Testing and 20% will be testing the UI elements, colour buttons etc.
  • No need for UI Testing by 100%.If we perform API Testing.
  • We can perform API Testing once the backend code and the APIs are ready. A gap will occur between the presentation and Application layer(it will take time to create UI). In that time, we can test our application using API's. 
  • API Testing is simple and easy to learn compared to Selenium web application Testing.



Saturday, April 27, 2024

Must-Have Security Test Cases for Your Web Application

1. Try to directly access the bookmarked web page without logging into the system.

2. Verify that the system should restrict you from downloading the file without signing in to the system.

3. Verify that previously accessed pages should not be accessible after logging out i.e. Sign out and then press the Back button to access the page accessed before.

4. Check the valid and invalid passwords, password rules say it cannot be less than 8 characters, user ID and password cannot be the same etc.

5. Verified that important i.e. sensitive information such as passwords, ID numbers, credit card numbers, etc should not be displayed in the input box when typing. They should be encrypted and in asterisk format.

6. Check Is bookmarking disabled on secure pages? Bookmarking Should be disabled on secure pages.

7. Check Is Right Click, View, Source disabled? The source code should not be visible to the user.

8. Check if your server locks out an individual who has tried to access your site multiple times with invalid login/password information?

9. Verify the timeout condition, after a timeout, the user should not be able to navigate through the site.

10. Check Are you prevented from doing direct searches by editing content in the URL?

11. Verify that the restricted page should not be accessible by a user after session time out.

12. ID/password authentication, the same account on different machines cannot log on at the same time. So at a time, only one user can log in to the system with a user ID.

13. ID/password authentication methods enter the wrong password several times and check if the account gets locked.

14. Add or modify important information (passwords, ID numbers, credit card numbers, etc.). Check if it gets reflected immediately or caching the old values.

15. Verify that the Error Message does not contain malicious info so that hackers will use this information to hack the website.