Sample API Test Cases In Excel Sheet

API Test Cases & API Testing Test Cases: API testing is an important step in the development of any application. The need for this is that applications nowadays are connected through APIs, which serve as the glue between applications.

Testing APIs is critical to maintaining and improving your product’s quality. It allows you to validate that all the endpoints are functional and following the documentation. It also allows you to prevent errors before they even occur.

Post On:API Testing Test Cases
Post Type:Test Case Template
Published On:www.softwaretestingo.com
Applicable For:Freshers & Experience
Get Updates:Software Testingo Telegram Group

Testing APIs is becoming a very common requirement. However, finding real and relevant use cases to test them against is often too hard. This article has collected some API testing tips to help you deliver better tests faster.

Testing APIs is no longer a low-risk endeavor. It is becoming essential for any company’s IT department to ensure the security of its applications and web services. With the increasing number of exposed APIs, testing becomes even more important. This article will provide tips and examples for testing your APIs effectively and efficiently.

You can also face questions like this for the same test cases: API test cases, API test cases in Excel, sample API test cases in Excel sheet, API testing test cases, test cases for API testing, sample manual test cases for API testing, sample test cases for API testing, sample API test cases, API test case template.

Test cases for API Testing

  • Validate the keys with the Min. and Max range of APIs (e.g., maximum and minimum length)
  • Keys verification. If we have JSON or XML APIs, we should verify that all the keys are coming.
  • Have a test case to do XML and JSON Schema validation.
  • Verify the Parse the Response data.
  • Verify the JSON Schema validation, the Field Type, and the Mandatory Fields.
  • Valid Response headers and negative cases response
  • Verify how the API error codes are handled.
  • Verify the response HTTP status code.
  • Valid Response payload
  • Chaining Request verification.
  • Verification of APIs with Data parameters.
  • End to End CRUD flows
  • Database Integrity Test Cases
  • File Upload Test cases

API Testing Test Cases

  • 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.
  • 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.
  • 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.
  • Verify 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 special-character string.
  • Verify that the API returns the correct results when searching for multiple-word strings.
  • Verify that the API returns the correct results when searching for a string combining 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.
  • 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).
  • 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 handles partial updates correctly (e.g., PATCH requests).
  • 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.
  • 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 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.
  • Verify that the API handles cross-site scripting (XSS) attacks and returns the correct HTTP status code.
  • Verify that the API handles SQL injection attacks correctly and returns the correct HTTP status code.
  • Verify that the API 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 handles SSL/TLS certificates correctly 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 handles authentication and authorization correctly and returns the correct HTTP status code.
  • Verify that the API handles request rate limiting and returns the correct HTTP status code.
  • Verify that the API 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.
  • Verify that the API correctly handles versioning and returns the correct HTTP status code.
  • 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 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 requests, such as GET, POST, PUT, DELETE, OPTIONS, HEAD, and PATCH.
  • 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).
  • 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 resources 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 the 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 webhooks and delivers the correct events to subscribed clients.
  • 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.
  • Verify that the API correctly handles encryption and decryption of data.
  • Verify that the API correctly handles the compression and decompression of data.
  • Verify that the API handles rate limiting based on a user account or IP address.
  • Verify that the API correctly handles authentication based on the 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.
  • Verify that the API correctly handles output sanitization and returns the correct HTTP status code and error message.
  • Verify that the API handles SQL injection prevention correctly and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles cross-site scripting (XSS) prevention and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles cross-site request forgery (CSRF) prevention and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles broken links and returns the correct HTTP status code and error message.
  • Verify that the API handles CORS preflight requests correctly and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles multi-language support and returns the correct resources for each language.
  • Verify that the API correctly handles multi-currency support and returns the correct resources for each currency.
  • Verify that the API correctly handles multi-timezone support and returns the correct resources for each timezone.
  • Verify that the API correctly handles multi-locale support and returns the correct resources for each locale.
  • Verify that the API correctly handles multi-region support and returns the correct resources for each region.
  • Verify that the API correctly handles multi-tenant support and returns the correct resources for each tenant.
  • Verify that the API correctly handles multi-environment support and returns the correct resources for each environment.
  • Verify that the API correctly handles multi-platform support
  • Verify that the API returns the correct response time for requests (e.g. GET, POST, PUT, DELETE).
  • Verify that the API correctly handles large payloads and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles small payloads and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles concurrent requests and returns the correct resources for each request.
  • Verify that the API correctly handles slow requests and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles high traffic and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles low traffic and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles error recovery and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles failover and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles load balancing and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles server clustering and returns the correct HTTP status code and error message.
  • Verify that the API correctly handles versioning and returns the correct resources for each version.
  • Verify that the API correctly handles API documentation and returns the correct resources for each API endpoint.
  • Verify that the API correctly handles API change logs and returns the correct resources for each API change.
  • Verify that the API correctly handles API testing and returns the correct resources for each API test.
  • Verify that the API correctly handles API monitoring and returns the correct resources for each API metric.
  • Verify that the API correctly handles API security and returns the correct resources for each API vulnerability.
  • Verify that the API correctly handles API performance and returns the correct resources for each API performance metric.
  • Verify that the API correctly handles API scalability and returns the correct resources for each API scalability metric.
  • Verify that the API correctly handles API availability and returns the correct resources for each API availability metric.
  • Verify that the API correctly handles API reliability and returns the correct resources for each API reliability metric.
  • Verify that the API correctly handles API maintainability and returns the correct resources for each API maintainability metric.
  • Verify that the API correctly handles API usability and returns the correct resources for each API usability metric.
  • Verify that the API correctly handles API accessibility and returns the correct resources for each API accessibility metric.
  • Verify that the API correctly handles API localization and returns the correct resources for each API localization metric.
  • Verify that the API correctly handles API internationalization and returns the correct resources for each API internationalization metric.
  • Verify that the API correctly handles API compliance and returns the correct resources for each API compliance metric.
  • Verify that the API correctly handles API analytics and returns the correct resources for each API analytic metric.
  • Verify that the API correctly handles API audit logs and returns the correct resources for each API audit log.
  • Verify that the API correctly handles API error logs and returns the correct resources for each API error log.
  • Verify that the API correctly handles API debug logs and returns the correct resources for each API debug log.
  • Verify that the API correctly handles API performance logs and returns the correct resources for each API performance log.
  • Verify that the API correctly handles API security logs and returns the correct resources for each API security log.
  • Verify that the API correctly handles API usage logs and returns the correct resources for each API usage log.
  • Verify that the API correctly handles API event logs and returns the correct resources for each API event log.
  • Verify that the API correctly handles the API version.

Sample Excel Sheet Format

Test Case IDTest Case DescriptionTest StepsExpected ResultActual ResultStatus
TC01Verify API Response Status CodeSend API request to [Endpoint].HTTP status code should be 200 OK.
TC02Verify API Response Format (JSON, XML)Send API request to [Endpoint].The response format should be [JSON/XML].
TC03Verify API Response Contains Expected FieldsSend API request to [Endpoint].The response should contain expected fields.
TC04Verify API Response Data for Each FieldSend API request to [Endpoint].The response data should be correct.
TC05Verify API Response Time Within Acceptable LimitsSend API request to [Endpoint].The response time should be within limits.
TC06Verify API Request Parameters Correctly PassedSend API request to [Endpoint] with correct parameters.Parameters should be correctly passed.
TC07Verify the API Request Method Correct (GET, POST, etc.)Send API request with the correct method (GET/POST/PUT/DELETE).The method used should be correct.
TC08Verify API Endpoint URLVerify the API endpoint URL.The endpoint URL should be correct.
TC09Verify API Response HeadersSend API request to [Endpoint].Response headers should be correct.
TC10Verify API Response Payload SizeSend API request to [Endpoint].Response payload size should be within limits.
TC11Verify API Handles Malformed RequestsSend a malformed API request.API should return an error message.
TC12Verify API Handles Authentication FailureSend API requests with incorrect authentication.API should return an authentication error.
TC13Verify API Handles Missing Request PayloadSend API request with missing payload.API should return an error message.
TC14Verify API Handles Non-Existent ResourceSend API requests for a non-existent resource.API should return a resource not found error.
TC15Verify API Handles Unauthorized AccessSend API requests without proper authorization.API should return an authorization error.
TC16Verify API Handles Request Payload Size LimitSend API requests with payload exceeding the limit.API should return an error message.
TC17Verify API Handles Invalid Request DataSend API requests with invalid data in the payload.API should return an error message.
TC18Verify API Handles Invalid Request MethodSend API request with an invalid method.API should return a method that does not allow error.
TC19Verify API Returns Success for Resource CreationSend API request to create a resource.API should return a success message.
TC20Verify API Returns Success for Resource UpdateSend API request to update a resource.API should return a success message.
TC21Verify API Returns Success for Resource DeletionSend API request to delete a resource.API should return a success message.
TC22Verify API Returns Success for Resource RetrievalSend API request to retrieve a resource.API should return a success message.
TC23Verify API Returns Correct Resource by IdentifierSend API requests with a specific identifier.API should return the correct resource.
TC24Verify API Returns Correct Resource by ParametersSend API requests with specific search parameters.API should return the correct resource.
TC25Verify API Response Contains Pagination InfoSend API request to [Endpoint].The response should contain pagination info.
TC26Verify API Response Sorting Based on ParametersSend API request with sorting parameters.The response should be sorted correctly.
TC27Verify API Response Contains Filtering InfoSend API requests with filtering parameters.The response should be filtered correctly.
TC28Verify API Returns Correct Results for Partial StringSend API request for a partial string search.API should return the correct results.
TC29Verify API Returns Correct Results for Case-Insensitive StringSend API request for a case-insensitive string search.API should return the correct results.
TC30Verify API Returns Correct Results for String with Special CharactersSend an API request for a string with a special characters search.API should return the correct results.
TC31Verify API Returns Correct Results for Multi-Word StringSend API request for a multi-word string search.API should return the correct results.
TC32Verify API Returns Correct Results for Alphanumeric StringSend API request for an alphanumeric string search.API should return the correct results.
TC33Verify API Returns Correct Results for String with SpacesSend API request for a string with spaces search.API should return the correct results.
TC34Verify API Returns Correct Results for String with Non-ASCII CharactersSend an API request for a string with a non-ASCII characters search.API should return the correct results.
TC35Verify API Returns Correct Results for String with Mixed Character TypesSend API request for a string with mixed character types search.API should return the correct results.
TC36Verify API Returns Correct Results for String with HTML TagsSend API request for a string with HTML tags search.API should return the correct results.
TC37Verify API Returns Correct Results for String with Escape CharactersSend API request for a string with escape characters search.API should return the correct results.
TC38Verify API Response Content TypeSend API request to [Endpoint].The response should have the correct content type.
TC39Verify API Response Compression (Accept-Encoding)Send API request with “Accept-Encoding” header set to “gzip”.The response should be compressed when the header is set.
TC40Verify API Response Not CompressedSend API request without “Accept-Encoding” header.The response should not be compressed.
TC41Verify API Response Not Compressed (Other Encoding)Send API request with the “Accept-Encoding” header set to another value.The response should not be compressed.
TC42Verify API Response Language (Accept-Language)Send API request with “Accept-Language” header for specific language.The response should be in the specified language.
TC43Verify API Response LocaleSend API request with “Locale” header for specific locale.The response should be in the specified locale.
TC44Verify API Response Timezone (Accept-Timezone)Send API request with “Accept-Timezone” header for specific timezone.The response should be in the specified timezone.
TC45Verify API Response with Nested Objects/ArraysSend API request to [Endpoint].The response should handle nested objects/arrays.

Conclusion:

API testing is an important step in the development of any application. It’s important to test your APIs regularly, especially if you’re developing them for a mobile app. By automating these tests, you can ensure that your apps continue to work properly and provide the best possible user experience. To learn more about API testing, check out our blog post here. If you can think of more of these test cases, you can share them with us in the comment section.

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

5 thoughts on “Sample API Test Cases In Excel Sheet”

Leave a Comment