Mid-LevelAPI & Integration Testing
How would you test API pagination?
- pagination
- edge cases
- data integrity
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Test: (1) First page returns correct page size. (2) Navigating all pages returns all records without duplicates. (3) Empty page when offset exceeds total. (4) Page size parameter works correctly. (5) Sorting is consistent across pages. (6) Total count header/field is accurate. (7) Edge cases: page=0, page=-1, pageSize=0, very large pageSize. For cursor-based pagination, verify cursor stability when data changes between requests.
What interviewers listen for
- Schema-first thinkingYou validate response shape before you assert on values, every time.
- Status-code literacyYou can defend why 401 vs 403 vs 422 matters for the consumer.
- Contract awarenessYou know when consumer-driven contract tests beat end-to-end checks.
- Auth fluencyYou can describe rotating tokens across parallel workers without secrets in logs.