API Test Examples & Cases
Test Cases
GET /product
GET /product
- Test for getting a product with a valid retailerProductId. Expected: Status 200, valid JSON response with product details.
- Test for getting a product with an invalid retailerProductId. Expected: Status 404, error message.
- Test for getting a product with a missing retailerProductId. Expected: Status 400, error message.
- Test for getting a product with no authentication or invalid token. Expected: Status 401, error message.
- Test for getting a product when the server is down. Expected: Status 500, error message.
PUT /product
PUT /product
- Test for updating a product with all required fields in the body and valid retailerProductId. Expected: Status 201, valid JSON response with updated product details.
- Test for updating a product with missing required fields in the body. Expected: Status 400, error message.
- Test for updating a product with an invalid retailerProductId. Expected: Status 404, error message.
- Test for updating a product with no authentication or invalid token. Expected: Status 401, error message.
- Test for updating a product when the server is down. Expected: Status 500, error message.
GET /prices/{id}
GET /prices/{id}
- Test for getting a price with valid retailerId and retailerProductId. Expected: Status 200, valid JSON response with product pricing information.
- Test for getting a price with missing or invalid retailerId or retailerProductId. Expected: Status 404, error message.
- Test for getting a price when the server is down. Expected: Status 500, error message.
POST /carts
POST /carts
- Test for creating a cart with all required fields in the body. Expected: Status 201, valid JSON response with created cart details.
- Test for creating a cart with missing required fields in the body. Expected: Status 400, error message.
- Test for creating a cart with no authentication or invalid token. Expected: Status 401, error message.
- Test for creating a cart when the server is down. Expected: Status 500, error message.
GET /carts/{id}
GET /carts/{id}
- Test for getting a cart with a valid cart ID. Expected: Status 200, valid JSON response with cart details.
- Test for getting a cart with an invalid or missing cart ID. Expected: Status 404, error message.
- Test for getting a cart with no authentication or invalid token. Expected: Status 401, error message.
- Test for getting a cart when the server is down. Expected: Status 500, error message.
POST /carts/{id}/fulfill
POST /carts/{id}/fulfill
- Test for fulfilling a cart with a valid cart ID. Expected: Status 200, valid JSON response with fulfilled cart details.
- Test for fulfilling a cart with an invalid or missing cart ID. Expected: Status 404, error message.
- Test for fulfilling a cart with no authentication or invalid token. Expected: Status 401, error message.
- Test for fulfilling a cart when the server is down. Expected: Status 500, error message.
Remember to replace retailerProductId
and id
with actual IDs while testing. For authorization-related tests, the ACCESS_TOKEN
must be replaced with actual tokens.
Updated 9 months ago