Managing test data effectively and ensuring all API functionality is covered by comprehensive testing.
Test data includes input values, expected outputs, and database state. Test coverage measures what percentage of API is tested. Higher coverage generally means fewer production defects, but 100% is not always practical. Focus on critical paths.
| Type | Description | Target |
|---|---|---|
| Endpoint Coverage | All endpoints tested | 100% |
| Scenario Coverage | Happy path + error cases + edge cases | 80-90% |
| Data Coverage | Valid, invalid, boundary values tested | 75%+ |
| Code Coverage | Source code executed by tests | 70-80% |
Scenario: You're testing an online shopping cart API. Your team has written 200 test cases but the API still has bugs in production that weren't caught during testing. Analysis shows the test coverage is: endpoint_coverage=95%, scenario_coverage=65%, data_coverage=40%. Your manager asks: 'Why are bugs escaping to production despite high endpoint coverage?' Provide analysis and propose a solution to improve test quality.