Testing pagination against a real API

Pagination looks trivial until a page boundary lands in the middle of a record set that is still being written to. The APIs below implement both common styles — page numbers with a total, and opaque cursors — so you can write a client against each and find out which assumptions your code is making.

How to practise it

  1. Walk every page of a collection and assert that the number of records you collected equals the total the API reported.
  2. Request a page past the end of the collection. Some APIs answer with an empty list and a 200; the Friends API answers 404. Both are defensible, and your client has to handle whichever it meets.
  3. Check the last page: it is almost always partially full, and off-by-one errors hide there.
  4. Walk the Bank API by cursor and confirm no record is skipped or repeated — the failure mode cursors are supposed to prevent.
  5. Combine pagination with a filter and verify the counts still agree.

APIs to try it on

Status codes involved

Other techniques

Getting started guide · All 37 mock REST APIs