{"id":496,"date":"2020-11-15T10:48:55","date_gmt":"2020-11-15T09:48:55","guid":{"rendered":"http:\/\/dufajn.pl\/?p=496"},"modified":"2020-11-15T10:48:57","modified_gmt":"2020-11-15T09:48:57","slug":"how-to-test-api-pagination","status":"publish","type":"post","link":"https:\/\/dufajn.pl\/?p=496","title":{"rendered":"How to test API pagination?"},"content":{"rendered":"\n<p>There are multiple articles on the Intenet about how to code API pagination correctly. Does this mean that this is a good place where we should write some test cases and test some developer&#8217;s solutions? Well, there are multiple places where bugs can sit in the software. But before you start using API solutions why not check them in detail?<\/p>\n\n\n\n<p>One of the most common mistakes is to provide not working parameters as <em>offset<\/em> or <em>max<\/em>. How to search for that kind of errors? When you want to fetch 100 results it gives only 99 of them. As a tester, you just should make a simple check and count each result entity. Check at the end did those match your <em>max <\/em>parameter. If not then you have the first kind of error found. Another simple check that you should perform is to check if those <em>max <\/em>parameter is really working for some big numbers. How big numbers use this depends on API and system but few simple checks and counting those entities will do the work.<\/p>\n\n\n\n<p>The 2nd kind of error is visible when you set the <em>offset <\/em>parameter. Sometimes the <em>offset<\/em> is starting from the previous record which is a bug. Sometimes <em>offset<\/em> is not returning correct parameters by mixing different records on different pages. Make sure to check if displayed entities by your API are unique across some queries with the <em>offset<\/em> parameter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are multiple articles on the Intenet about how to code API pagination correctly. Does this mean that this is<\/p>\n","protected":false},"author":3,"featured_media":506,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"class_list":["post-496","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-testing"],"_links":{"self":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=496"}],"version-history":[{"count":7,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/496\/revisions\/505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/media\/506"}],"wp:attachment":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}