API Testing · Senior · Question 54 of 75
Why include negative tests in API contract tests?
- 1Negative tests make the contract files much smaller
- 2Clients rely on errors, like a 404 for missing items
- 3Contracts can't describe successful responses
Show the answer
Correct answer: Clients rely on errors, like a 404 for missing items
Explanation
If a provider changes "not found" from 404 to 200 with null, consumers break. The contract should pin it down.