Understanding common defect types and issues found during API testing to improve detection.
API testing commonly uncovers defects that UI testing might miss because API tests directly access business logic. Understanding common defect patterns helps testers write better test cases.
| Defect | Example |
|---|---|
| Incorrect Status Codes | Returns 200 when should return 400 for invalid input |
| Wrong Response Format | JSON missing required fields or has wrong data types |
| Calculation Errors | Total price calculated incorrectly |
| Database Inconsistency | API returns success but data not saved to database |
| Authorization Bypass | User can access other user's data |
| Performance Issues | API response time exceeds acceptable SLA |
| Race Conditions | Concurrent requests cause data corruption |
| Error Handling | No error message when operation fails |
Scenario: Your payment API in production has started showing intermittent errors. The issue manifests as: (1) User A transfers $500 to User B, API returns 200 Success, (2) User A checks balance - shows $500 deducted (correct), (3) But User B's account ALSO shows a balance reduction of $500 (WRONG - should increase by $500), (4) This happens randomly - sometimes 10% of transfers have this issue, sometimes 0%, (5) When API is restarted, issue disappears for a few hours then returns. Diagnose the issue and provide testing strategy to catch it.