Senior
The method places an order on the website. It accepts: 1. List of shipments with products 2. Expected delivery date for each shipment 3. Delivery address with comments 4. Payment method, e.g., bank card. Limit on address.comment length - 200 characters Limit on shipments - 200 objects You need to test (create a checklist of checks) this method. POST /order { "shipments": [ // shipments/boxes with products { "id": "number", "date": "number" // Expected delivery date } ], "adress": { "id": "number", "comment": "string", "is_leave_at_door": "boolean" // leave at the door }, "payment_method": "string" # card / apple_pay }
sobes.tech AI
Answer from AI
Test checklist for POST /order method:
-
Input validation:
- Check that the
shipmentsfield is present and contains no more than 200 objects. - Verify that each object in
shipmentshas correctid(number) anddate(number, valid date). - Ensure that the
adressfield is present and containsid(number),comment(string, no more than 200 characters),is_leave_at_door(boolean). - Check that the
payment_methodfield contains valid values (card,apple_pay).
- Check that the
-
Boundary values:
- Send requests with 0, 1, 200, and more than 200 shipments.
- Verify the length of
adress.commentat 0, 200, and more than 200 characters.
-
Format and data types:
- Send incorrect data types (string instead of number, number instead of boolean).
- Send empty or missing fields.
-
Processing logic:
- Verify that the order is created correctly with valid data.
- Check behavior with invalid data (expecting an error with a clear message).
-
Security:
- Test protection against SQL injections in
commentand other fields. - Verify that the method requires authentication if applicable.
- Test protection against SQL injections in
-
Performance:
- Check response time with the maximum number of shipments.
-
Additional checks:
- Verify that
is_leave_at_doorcorrectly influences delivery logic.
- Verify that
Example of a comment length test:
{
"shipments": [{"id": 1, "date": 1686000000}],
"adress": {"id": 10, "comment": "a".repeat(201), "is_leave_at_door": true},
"payment_method": "card"
}
Expected error due to exceeding the 200-character limit.