← Back to libraryQuestion 196 of 273
🌐API TestingIntermediate

Common API Testing Defects and Issues

📌 Definition:

Understanding common defect types and issues found during API testing to improve detection.

📖 Detailed Explanation:

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.

📎 Common Defects:
DefectExample
Incorrect Status CodesReturns 200 when should return 400 for invalid input
Wrong Response FormatJSON missing required fields or has wrong data types
Calculation ErrorsTotal price calculated incorrectly
Database InconsistencyAPI returns success but data not saved to database
Authorization BypassUser can access other user's data
Performance IssuesAPI response time exceeds acceptable SLA
Race ConditionsConcurrent requests cause data corruption
Error HandlingNo error message when operation fails
📎 Defect Categories:
  • Functional defects - API doesn't work as specified
  • Performance defects - API too slow or can't handle load
  • Security defects - Unauthorized access or data exposure
  • Data defects - Incorrect calculations or data corruption
🎯 Scenario-Based Interview Question:

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.