Lesson 01 Introduction To API Testing
Lesson 01 Introduction To API Testing
After completing this session, John will be able to use Postman to set
up, configure, and test APIs.
Learning Objectives
API testing evaluates the APIs for security, reliability, and accuracy.
What Is API Testing?
A data layer, a service layer (the API layer), and a presentation layer (user interface layer) are
the three layers that most applications contain.
API testing examines the business logic and the security of the application and data replies.
The API layer contains the application's business logic. More precisely, it describes how users
can interact with the app's services, functions, and data.
An API test is typically carried out by sending requests to one or more API endpoints and
comparing the results to what is expected.
How to Approach API Testing?
API testing should start with a clearly defined program scope and a thorough understanding
of how the API performs.
The following are some questions that testers should think about:
Users can perform several API tests to confirm that the API is functioning correctly. These
tests range from broad to detailed examination of the software.
Validation Testing
Functional Testing
Security Testing
Here are some
instances of Penetration Testing
these API tests:
Load Testing
Reliability Testing
Fuzz Testing
Validation Testing
Validation testing consists of a few simple queries covering the project's entirety.
• Was the right product • Is the correct data • Is this API the most
created? accessed the way it efficient and precise
should be? way to complete a
• Is the developed API task?
the best solution for • Is excessive amount of
the problem it is data accessed? • Is it possible to change
attempting to solve? or remove any
• Is the data stored codebase to improve
• Was there any severe correctly through the overall service and
code bloat throughout API after considering eliminate
development that the data set's specific impairments?
would make the API integrity and
unsustainable? confidentiality needs?
Functional Testing and Load Testing
Functional testing guarantees that the API does Load testing is a technique for determining how
what it is designed to do. many requests an API can handle.
This test examines certain functions in the This test is frequently carried out after a specific
codebase to ensure that the API operates unit, or the entire codebase has been
within its expected parameters and can handle completed to see if the theoretical answer can
errors if the results fall outside of those also operate as a practical solution when
parameters. working under a specified load.
Reliability Testing and Security Testing
Reliability testing guarantees that the API In the more extensive security auditing process,
produces consistent results and maintains a security testing is frequently lumped in with
constant connection between platforms. penetration and fuzz testing.
Penetration testing is a step forward from Fuzz testing involves forcing large amounts of
security testing. random data into a system, often known as
noise or fuzz, to induce undesired behavior
An individual with insufficient knowledge of the such as a caused crash or overflow.
API attacks the API in this test. It allows testers
to look at the attack vector from a different
angle. Penetration testing attacks might be
limited to certain aspects of the API, or they can
target the API as a whole.
API Testing Best Practices
Best Practices of API Testing
REpresentational State Transfer (REST) and Simple Object Access Protocol (SOAP)
are different types of API architecture. Both the APIs serve different purposes.
REST requests are written in JSON, whereas SOAP requests are in XML.
API Testing Tools
Postman
What Is Postman?
Postman is a tool used to build and test APIs. It simplifies each step of the API lifecycle
and streamlines collaboration so that users can create efficient APIs faster.
Why Use Postman?
Intelligence
Improves API operations Workspaces
by leveraging advanced Organizes API work
features, such as search, and collaborates
notifications, warnings, with teammates or
and so on stakeholders worldwide
Element Use
• Imports from a file, folder, or link and paste the raw data
Import
• Brings a 'collection' or an 'environment' into the program
Element Use
HTTP
Lists menu for different requests,
request
such as Get, POST, and so on
option
Enter
Allows users to enter the endpoints
request
(URL)
URL
Allows users to enter key values that
Params
an API needs
Allows users to enter request
Header
headers
Allows users to add details
Body
in a request
Allows users to save changes
Save
to a request
Basics Before Creating the First API Request
Basics Before Creating the First API Request
Here are some basic terms to know before hitting the first API:
Term Meaning
When users send a command, the server accepts it and reciprocates with some information.
Request
This command is known as a request.
Response A response is a message that a client sends to the server in response to a user’s request.
Basics Before Creating the First API Request
Users can parameterize the GET and POST requests by adding data in the request body or the URL.
There are two types of parameters:
Query They are appended to the end of the request URL. After the '?' syntax, they
?id=1&type=new
parameters are listed as key-value pairs separated by the '&' syntax.
Path
They are placeholders in the request URL before the colon ':'. /customer/:id
parameters
How SOAP Works with Postman?
SOAP
Simple Object Access Protocol, or SOAP is a messaging protocol for computer communication
based on XML.
GET and POST are the most commonly used HTTP methods.