Mid-LevelAPI & Integration Testing
Explain how you would test API pagination thoroughly.
- pagination
- data integrity
- edge cases
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Test cases: (1) First page returns correct count and has next link. (2) Last page has no next link. (3) Empty collection returns empty array. (4) Page size parameter is respected. (5) Cursor/offset consistency when data changes between pages. (6) Invalid page numbers return appropriate errors. (7) Large page sizes are capped. (8) Total count accuracy. (9) Sorting is consistent across pages, no duplicate or missing items. (10) Performance with large datasets. Both offset-based and cursor-based pagination have different edge cases to cover.
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.