0% found this document useful (0 votes)
8 views

Api Testing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Api Testing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Sample API Test Cases

for API Testing

bhavin-thumar
Verify that the API response status code
is 200 OK.
Verify that the API response is in the
expected format (e.g., JSON, XML).
Verify that the API response contains all
the expected fields.
Verify that the API response contains the
correct data for each field.
Verify that the API response time is within
acceptable limits.
Verify that the API request parameters
are correctly passed to the API.
Verify that the API request method is
correct (e.g., GET, POST, PUT, DELETE).
Verify that the API endpoint URL is
correct.
Verify that the API response headers are
correct.
Verify that the API response payload size
is within acceptable limits.

bhavin-thumar
Verify that the API returns an error
message if the request is malformed.
Verify that the API returns an error
message if the authentication fails.
Verify that the API returns an error
message if the request payload is
missing.
Verify that the API returns an error
message if the requested resource does
not exist.
Verify that the API returns an error
message if the requested resource is not
authorized.
Verify that the API returns an error
message if the request payload exceeds
the allowed limit.
Verify that the API returns an error
message if the request payload contains
invalid data.

bhavin-thumar
Verify that the API returns an error
message if the request method is not
allowed for the resource.
Verify that the API returns a success
message if the resource is created
successfully.
Verify that the API returns a success
message if the resource is updated
successfully.
Verify that the API returns a success
message if the resource is deleted
successfully.
Verify that the API returns a success
message if the resource is retrieved
successfully.
Verify that the API returns the correct
resource based on the provided resource
identifier.

bhavin-thumar
Verify that the API returns the correct
resource based on the provided search
parameters.
Verify that the API response contains the
correct pagination information.
Verify that the API response contains the
correct sorting order based on the
provided sort parameter.
Verify that the API response contains the
correct filtering information based on the
provided filter parameters.
Verify that the API returns the correct
results when searching for a partial
string.
Verify that the API returns the correct
results when searching for a case-
insensitive string.
Verify that the API returns the correct
results when searching for a string with
special characters.

bhavin-thumar
Verify that the API returns the correct
results when searching for a string with
multiple words.
Verify that the API returns the correct
results when searching for a string with a
combination of letters and numbers.
Verify that the API returns the correct
results when searching for a string with
spaces.
Verify that the API returns the correct
results when searching for a string with
non-ASCII characters.
Verify that the API returns the correct
results when searching for a string with
mixed character types (e.g., letters,
numbers, symbols).
Verify that the API returns the correct
results when searching for a string with
HTML tags.

bhavin-thumar
Verify that the API returns the correct
results when searching for a string with
escape characters.
Verify that the API response contains the
correct resource representation based on
the provided content type.
Verify that the API response is
compressed when the client sends a
request with the "Accept-Encoding"
header set to "gzip."
Verify that the API response is not
compressed when the client does not
send the "Accept-Encoding" header.
Verify that the API response is not
compressed when the client sends a
request with the "Accept-Encoding"
header set to a value other than "gzip."
Verify that the API response contains the
correct resource representation based on
the specified language (e.g., English,
Spanish, French).
bhavin-thumar
Verify that the API response contains the
correct resource representation based on
the specified locale (e.g., en-US, fr-FR).
Verify that the API response contains the
correct resource representation based on
the specified time zone.
Verify that the API response contains the
correct resource representation when the
resource contains nested objects or
arrays.
Verify that the API returns a response
within a specified timeout period.
Verify that the API handles concurrent
requests correctly.
Verify that the API returns a response
with a custom HTTP header when a
specific request header is sent.
Verify that the API correctly handles file
uploads and downloads.

bhavin-thumar
Verify that the API response contains the
correct resource representation based on
the specified currency.
Verify that the API correctly handles rate
limiting and returns the correct HTTP
status code.
Verify that the API correctly handles
retries and returns the correct HTTP
status code.
Verify that the API correctly handles
redirects and returns the correct HTTP
status code.
Verify that the API correctly handles
cookies and returns the correct HTTP
status code.
Verify that the API correctly handles
caching and returns the correct HTTP
status code.
Verify that the API correctly handles CSRF
tokens and returns the correct HTTP
status code.
bhavin-thumar
Verify that the API correctly handles
cross-site scripting (XSS) attacks and
returns the correct HTTP status code.
Verify that the API correctly handles SQL
injection attacks and returns the correct
HTTP status code.
Verify that the API correctly handles
cross-site request forgery (CSRF) attacks
and returns the correct HTTP status code.
Verify that the API correctly handles input
validation and returns the correct HTTP
status code.
Verify that the API correctly handles
output encoding and returns the correct
HTTP status code.
Verify that the API correctly handles
SSL/TLS certificates and returns the
correct HTTP status code.
Verify that the API correctly handles
content negotiation and returns the
correct HTTP status code.
bhavin-thumar
Verify that the API correctly handles
authentication and authorization and
returns the correct HTTP status code.
Verify that the API correctly handles
request rate limiting and returns the
correct HTTP status code.
Verify that the API correctly handles retry
attempts and returns the correct HTTP
status code.
Verify that the API correctly handles
timeouts and returns the correct HTTP
status code.
Verify that the API correctly handles
network failures and returns the correct
HTTP status code.
Verify that the API correctly handles race
conditions and returns the correct HTTP
status code.
Verify that the API correctly handles
caching and returns the correct HTTP
status code.
bhavin-thumar
Verify that the API correctly handles
versioning and returns the correct
resources for each version.
Verify that the API correctly handles
version negotiation and returns the
correct HTTP status code.
Verify that the API correctly handles
content negotiation and returns the
correct HTTP status code.
Verify that the API correctly handles
partial updates and returns the correct
HTTP status code.
Verify that the API correctly handles error
conditions and returns the correct HTTP
status code and error message.
Verify that the API correctly handles
various types of requests, such as GET,
POST, PUT, DELETE, OPTIONS, HEAD, and
PATCH.

bhavin-thumar
Verify that the API correctly handles
various types of data, such as strings,
numbers, dates, and binary data.
Verify that the API correctly handles
various types of authentication, such as
basic authentication, token
authentication, and OAuth.
Verify that the API correctly handles
various types of authorization, such as
role-based.
Verify that the API returns the correct
HTTP status code for requests that are
not supported (e.g., HTTP 405 Method
Not Allowed).
Verify that the API returns the correct
HTTP status code for invalid requests
(e.g., HTTP 400 Bad Request).
Verify that the API returns the correct
HTTP status code for unauthorized
requests (e.g., HTTP 401 Unauthorized).

bhavin-thumar
Verify that the API returns the correct
HTTP status code for forbidden requests
(e.g., HTTP 403 Forbidden).
Verify that the API returns the correct
HTTP status code for resource not found
(e.g., HTTP 404 Not Found).
Verify that the API correctly handles
pagination and returns the correct
resources for each page.
Verify that the API correctly handles
sorting and filtering of resources.
Verify that the API correctly handles
searching for resources based on specific
criteria.
Verify that the API correctly handles batch
requests and returns the correct
resources for each batch.
Verify that the API correctly handles web
hooks and delivers the correct events to
subscribed clients.

bhavin-thumar
Verify that the API correctly handles
server-side validation and returns the
correct HTTP status code and error
message.
Verify that the API correctly handles
client-side validation and returns the
correct HTTP status code and error
message.
Verify that the API correctly handles field-
level validation and returns the correct
HTTP status code and error message.
Verify that the API correctly handles
database transactions and returns the
correct HTTP status code and error
message.
Verify that the API correctly handles
database backups and restores and
returns the correct HTTP status code and
error message.

bhavin-thumar
Verify that the API correctly handles
encryption and decryption of data.
Verify that the API correctly handles
compression and decompression of data.
Verify that the API correctly handles rate
limiting based on user account or IP
address.
Verify that the API correctly handles
authentication based on user account or
API key.
Verify that the API correctly handles
authorization based on user roles or
permissions.
Verify that the API correctly handles
cross-origin resource sharing (CORS) and
returns the correct HTTP status code and
error message.
Verify that the API correctly handles input
sanitization and returns the correct HTTP
status code and error message.

bhavin-thumar

You might also like