Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataMiddleOccasionalTheory

How should tests differ for PUT and PATCH update operations?

Answer

PUT normally represents replacement of a resource and is idempotent; PATCH applies a partial modification whose semantics depend on the patch format. Test omitted fields, repeated requests, conflicting updates, validation and resulting representation.

Strong answer includes

  • replacement versus partial change
  • idempotency
  • omitted and conflicting fields

Practical example

A tester sends the same PUT request twice and confirms the resource ends up identical both times, proving idempotency; then sends a PATCH with only one field and verifies the other fields stayed untouched instead of being wiped out, which is a bug they've seen before in a naive PATCH implementation.

#http-methods#put#patch

Sources

MDN HTTP referenceMozilla · HTTP methods, messages, status codes, headers, cookies and cachingOpenAPI Specification 3.2.0OpenAPI Initiative · API contracts, schemas and operation descriptions