0% found this document useful (0 votes)
102 views11 pages

Basic API Testing (Postman)

The document discusses client-server architecture and APIs. It explains that a client is the device or software that accesses a service provided by a server. Common client-server architectures include one-tier, two-tier, and three-tier, with three-tier separating the presentation, business logic, and data layers. The document then defines APIs and describes common API types like REST and SOAP. It also discusses Postman, an API testing tool that allows creating and sending HTTP requests and examining responses.

Uploaded by

reshmashaik4656
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
102 views11 pages

Basic API Testing (Postman)

The document discusses client-server architecture and APIs. It explains that a client is the device or software that accesses a service provided by a server. Common client-server architectures include one-tier, two-tier, and three-tier, with three-tier separating the presentation, business logic, and data layers. The document then defines APIs and describes common API types like REST and SOAP. It also discusses Postman, an API testing tool that allows creating and sending HTTP requests and examining responses.

Uploaded by

reshmashaik4656
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

API

TESTING
POSTMAN
Basic - Part 1

By
V.R
What is Client and Server -

Client is a computer hardware device or a software that accesses a


service made available by a server. In simple words we can say “from
where we are trying to access is called a client”.
The server is often (but not always) located on a separate physical
computer.

Server is a physical computer dedicated to run services to serve the needs


of other computers. Depending on the server that is running, it could be a
file server, database server, home media server, print server, or web
server.

Client/Server Architecture -

1. One - Tier architecture


2. Two - Tier architecture
3. Three - Tier architecture

One - Tier Architecture -

 In one-tier architecture, all layers of the application are combined and


executed on a single machine.
 The user interface, business logic, and data storage reside on the same
system.
 This architecture is commonly used for small, standalone applications.
Two - Tier Architecture -

 In two-tier architecture, the application is divided into two layers: the


client layer and the server layer.
 The client layer is responsible for the user interface and directly
interacts with the end-user.
 The server layer handles the business logic and data processing.
 Two-tier architecture is commonly known as client-server
architecture.

Three - Tier Architecture -

 Three-tier architecture divides the application into three layers:


presentation layer, business logic layer, and data storage layer.
 Presentation layer, also known as the client layer, handles the user
interface and user interactions.
 Business logic layer contains the application's logic and processes
user requests.
 Data storage layer, also known as the data access layer, manages data
storage and retrieval.

Examples -

 One - Tier Architecture: Standalone applications like Calculator.


 Two - Tier Architecture: Admin servers like Bank. (where multiple
staff members will use the admin server).
 Three - Tier Architecture: Web applications like E-commerce website.

Layers in Three - Tier Architecture -

 Presentation Layer (HTML, JavaScript, CSS)


 Application Layer (Java, .Net, C#, Python, C++)
 Data Layer (Mysql, MangoDB, Oracle)

What is an API -

API (Application Program Interface) is the way of communication


between two applications where applications may differ in their platforms
or in terms of technology.

It is a way of communication between two layers.


Front-End of the application

Middle-Layer (API Layer)

Back-End of the application

Types of API’s -

 SOAP (Simple Object Access Protocol).


 REST (Representational State Transfer).
 SOAP and Rest both are Web Services.

API vs Web Services -

 Web service is an API wrapped in HTTP.


 All web services are API’s but API’s are not web services.
 A web service need a network while an API doesn’t need a network
for its operation.

Rest API Methods -

 GET - Receive information about an API resource.


 POST - Create an API resource.
 PUT - Update an API resource.
 DELETE - Delete an API resource.
HTTP vs HTTPS -

HTTP - Not most secured.


HTTPS - More secured.Data is in encrypted format.

What is URI, URL, URN -

URI - Uniform Resource Identifier


URL - Uniform Resource Locator
URN - Uniform Resource Name

Examples -

URL - https://google.com/api/testing
URI - //google.com/api/testing
URN - /api/testing

https://google.com/apis/testing

Scheme Host Path

Features & Resource -

Feature is the term used in manual testing to test some functionality.

Resource is the term used in API Automation testing referring some


functionality.

Payload -

Payload means the body in the HTTP request and response message.

Request Payload - The data which is sending through request is called


Request Payload.

Response Payload - The data which is coming through response is called


Response Payload.
POSTMAN
 Postman is a stand-alone API (Application Programming Interface)
testing tool for creating, testing, designing, modifying, and
documenting APIs. It's a straightforward graphical user interface for
sending and examining HTTP requests and answers.
 It is not necessary to develop any HTTP client network code while
using Postman for testing purposes. Instead, we create sets of test
suites and let Postman interact with the API.

[Please install Postman by referring website or you-tube]

After downloading and installing Postman in our system, we will now


discuss the user interface of Postman to learn about the features and
terminologies that Postman offers.

Postman Interface -

 Workspace - Area where we maintain files and saved. Able to Create


workspace, Rename, Delete.
 Collection - It contains number of folders and http request. Able to
Create, Rename, Delete, Run the collection.
 HTTP Request - To create HTTP request and can run a request.
Create a HTTP Request in Postman -

1. Create a New Workspace


2. Create a Collection under workspace
3. Create HTTP request in the collection
4. Select GET method in HTTP request
5. Enter a URL https://www.google.com/
6. Run the HTTP request by clicking on Send
7. After running, the response will be displayed

Validations -

After sending the request the response will be displayed in response block.
From this response we can validate like:

1. Status Code
2. Body
3. Cookies
4. Headers
5. Test Results
6. Time
7. Size

Status Code -

In Postman, status codes are numeric codes that indicate the response
status of an HTTP request. They provide information about the outcome
of the request and help in understanding whether the request was
successful or encountered an error.

Some commonly used codes are:

Level 200 -
200 : OK
201 : Created
202 : Accepted
203 : Non - Authoritative info
204 : No Content
Level 200 is Successful level information.
Level 400 -
400 : Bad Request
401 : Unauthorized
403 : Forbidden
404 :Not Found
409 : Conflict
Level 400 is when request is unauthorized or not specified proper
authorization.

Level 500 -
500 : Internal Server
501 : Not Implemented
502 : Bad Gateway
503 : Service Unavailable
504 : Gateway Timeout
599 : Network Timeout
Level 500 is when there is a network issue server down or maintenance.

Time -

Time refers to the response time of an API request. It measures the


duration it takes for the request to be sent to the server, processed, and the
response to be received back.

Size -

Size refers to the size of the HTTP response received from the server
when making an API request. It indicates the total size of the response
body, including the headers and the response payload.

Response Body -

A Response body is the body of the response, which actually contains the
response content that has been sent from the server. In this section, you
can see the web page code is sent to us as a response.
Headers -

In Postman, the header refers to a part of an HTTP request or response


that contains additional information about the message being sent or
received. Headers are key-value pairs that provide details such as the
content type, authorization credentials, caching instructions, and more.

In the context of an HTTP request, the header typically includes


information such as the request method (e.g., GET, POST, PUT), the
content type of the request body (e.g., JSON, XML), and any
authentication or authorization details.

Test Results -

The Test Results refer to the outcome or output of running tests within a
request or collection. When you send a request in Postman, you can
include tests that will be automatically executed after the request is sent.
These tests are written in JavaScript and can be used to verify the
response received from the server.

The Test Results in Postman provide information about the execution of


these tests, including whether the tests passed or failed, along with any
error messages or assertions that were made during the testing process.

Cookies -

Cookies are small text files that are created by websites and stored on a
user's device (such as a computer or mobile device) through the user's
web browser. They are used to store information about the user's
browsing activity and preferences.

In Postman, cookies are small pieces of data that are sent by a web server
to a client and are stored on the client-side. Cookies are used to maintain
session information and track user activity across multiple requests and
responses.

You might also like