Sobes.tech
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:

  1. Input validation:

    • Check that the shipments field is present and contains no more than 200 objects.
    • Verify that each object in shipments has correct id (number) and date (number, valid date).
    • Ensure that the adress field is present and contains id (number), comment (string, no more than 200 characters), is_leave_at_door (boolean).
    • Check that the payment_method field contains valid values (card, apple_pay).
  2. Boundary values:

    • Send requests with 0, 1, 200, and more than 200 shipments.
    • Verify the length of adress.comment at 0, 200, and more than 200 characters.
  3. Format and data types:

    • Send incorrect data types (string instead of number, number instead of boolean).
    • Send empty or missing fields.
  4. Processing logic:

    • Verify that the order is created correctly with valid data.
    • Check behavior with invalid data (expecting an error with a clear message).
  5. Security:

    • Test protection against SQL injections in comment and other fields.
    • Verify that the method requires authentication if applicable.
  6. Performance:

    • Check response time with the maximum number of shipments.
  7. Additional checks:

    • Verify that is_leave_at_door correctly influences delivery logic.

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.