Senior
Write a positive test case for the DELETE operation (object deletion).
sobes.tech AI
Answer from AI
A positive test case for the DELETE operation might look like this:
Title: Successful deletion of an existing object
Preconditions: An object with a unique identifier exists in the system.
Steps:
- Send a DELETE request to the delete endpoint with the correct identifier.
- Verify that the server returns a status of 200 OK or 204 No Content.
- Attempt to retrieve the object using the same identifier.
Expected result:
- The response to DELETE confirms successful deletion.
- Attempting to get the object returns a status of 404 Not Found or similar, confirming that the object has been deleted.
Example on REST API:
DELETE /api/items/123 HTTP/1.1
Host: example.com
---
HTTP/1.1 204 No Content
GET /api/items/123 HTTP/1.1
Host: example.com
---
HTTP/1.1 404 Not Found
This test verifies that the delete operation is successful and the object truly disappears from the system.