[Test Scenario] Follow this to Test Pagination of Back-end like a Pro 🏆

Sajitha Pathirana
3 min readAug 10, 2023

Let’s assume the back-end is implemented with REST.

Test Pagination of BE like a PRO

Request — GET /product/search?page=1&size=10

Response

{
"metadata": {
"page": 1,
"perPage": 10,
"pageCount": 2,
"totalCount": 14
},
"results": [
{
"product": "Pen",
"quantity": "10",
"unitprice": "2""currency": "USD",
"modifiedDate": "2022–06–21T11:45:22.921238"
} ,
…
]
}

If you observe the response payload carefully, metadata section controls the pagination in the back end. Similar to the front-end user interface in the below article, you can change the page, size or number of records per page from the request passed as query params.

Let’s derive the possible test scenarios.

1. Check the functionality with the default values of page and size

Make the request with size 10 and page is 1

Expected
pageCount should be 1
totalCount should remain the same
perPage should be 10…

--

--

Sajitha Pathirana

A Test automation enthusiast, passionate to help the teams to enhance their testing journey with his decade of experience in the field.