📓Test Cases
List of few common test actions to write on test case
API Test Actions
Test Action | Description |
---|---|
Verify Correct HTTP Status Code | Ensure that the API returns the expected HTTP status codes for different operations. |
Verify Response Payload | Check the validity of the response payload, ensuring correct field names, types, and values. |
Verify Response Headers | Validate the response headers returned by the API, considering security and performance implications. |
Verify Correct Application State | Inspect the application state after API requests to ensure the desired changes have been applied correctly. |
Verify Basic Performance Sanity | Check if API operations are completed within a reasonable time frame, identifying potential performance issues. |
Verify Authentication | Validate the API's handling of authentication mechanisms, including proper usage of credentials and tokens. |
Verify Authorization | Ensure that the API enforces proper authorization rules, restricting access to resources based on user permissions. |
Verify Error Handling | Evaluate how the API handles errors, ensuring appropriate error responses with meaningful messages and codes. |
Verify Data Manipulation | Test data manipulation operations, such as creating, updating, and deleting data, ensuring integrity and consistency. |
Verify Security Vulnerabilities | Conduct security testing to identify and address common vulnerabilities in the API, such as injection or XSS attacks. |
Verify Boundary Conditions | Test how the API handles edge cases and boundary conditions, ensuring appropriate responses and error handling. |
Verify Integration | Validate the integration of the API with other systems or third-party services, ensuring seamless data exchange. |
Example Scenario:
Let's consider an example scenario for an e-commerce API.
Scenario: Verify Product Creation API
Verify API Test Action | Description |
---|---|
Verify Correct HTTP Status Code | Check that the API returns a 201 CREATED status code upon successfully creating a new product. |
Verify Response Payload | Ensure that the response payload contains the created product's information with correct field names and values. |
Verify Response Headers | Validate that the response headers include the appropriate content-type and caching headers for the product. |
Verify Correct Application State | Manually inspect the product list or search for the newly created product to confirm its existence and details. |
Verify Basic Performance Sanity | Measure the time taken for the API to create the product, ensuring it completes within an acceptable time frame. |
Verify Authentication | Validate that the API requires proper authentication, such as an API key or access token, for the product creation. |
Verify Authorization | Ensure that only authorized users with specific roles or permissions can create products through the API. |
Verify Error Handling | Test error scenarios, such as providing invalid or missing data, and verify that appropriate error responses are returned. |
Verify Data Manipulation | Check that the newly created product is stored correctly and its details can be retrieved or updated as expected. |
Verify Security Vulnerabilities | Perform security tests to identify and address vulnerabilities, such as injection attacks, in the product creation API. |
Verify Boundary Conditions | Test edge cases like creating a product with an empty name or an excessively long description to validate appropriate handling. |
Verify Integration | Ensure seamless integration of the product creation API with other systems, such as verifying data synchronization with a product catalog. |
Last updated