Pagination helps users navigate large datasets without overloading a page, but errors can still affect navigation, data accuracy, and boundary conditions. Pagination test cases help QA teams verify these scenarios, along with accessibility, responsiveness, and error handling.
This guide covers essential pagination test cases, key edge cases, and ways to automate repeatable scenarios.
What is Pagination?
Pagination testing is the process of verifying that an application correctly displays and manages data across multiple pages. It checks whether users can navigate between pages, use controls such as Next, Previous, and page numbers, and see the correct data on each page.
It also verifies that page transitions, sorting, filtering, and navigation state work consistently without data duplication, omission, or unexpected changes.
For example, an e-commerce application may display 20 products per page from a catalog of 200 products. Pagination testing should verify whether users can navigate properly between pages using controls like Next, Previous, or specific page numbers.
It should also confirm that:
- Correct products appear on each page.
- No products are duplicated or skipped between pages.
- The correct number of pages is displayed.
- Next and previous behave correctly
- Changing page size updates the dataset and page count correctly.
- Filter and sorting remain consistent when users browse
- Invalid pages are handled gracefully.
Also Read: Test Cases for ECommerce Website
What are the Components of Pagination?
Pagination is more than a collection of navigation buttons.
A complete pagination test lifecycle should validate the relationship between the controls, displayed data, application state, and user interaction.
Testers can use the following areas to build pagination test coverage:
| Test area | What to verify |
|---|---|
| Navigation | Next, Previous, First, Last, and page-number controls |
| Data accuracy | Correct records appear on each page without duplicates or skipped records. |
| Page boundaries | First page, last page, empty datasets, one-page datasets, and invalid pages |
| Page size | Changing the number of records per page updates the view and page count. |
| Dynamic data | Pagination remains valid when records are added, deleted, or updated. |
| URL and state | Direct page URLs, refresh, browser Back/forward, filters, and sorting |
| Loading and errors | Slow responses, failed requests, duplicate clicks, and unavailable pages |
| Accessibility | Keyboard navigation, accessible names, current-page state, and screen-reader behavior |
| Responsive behavior | Pagination remains usable across screen sizes and orientations. |
| Performance | Page response, rendering behavior, and large datasets |
| Cross-browser/device compatibility | Consistent behavior across supported browsers and devices |
This coverage-based approach helps prevent a common testing gap: validating that a button works without validating whether the right state and data result from that interaction.
Also Read: Test Cases for Search Functionality
Types of Pagination Test Cases
Every pagination test case falls into one of two buckets, and writing your test case around this split helps you dodge a whole category of bugs.
Positive test cases confirm the feature works when everything is used the way it’s supposed to be. You are able to click Next on page 1, select 20 items per page, and jump to page 3 via the numbered links. These are the tests that prove the happy path is solid.
Negative test cases confirm the feature fails gracefully when it’s pushed outside normal use. Like clicking Next while already on the last page or typing “page 999” when there are only 10, loading a page with zero results. These are the tests that protect your app’s reputation when a user (or a bot, or a bookmarked URL) does something unexpected.
Most teams over-invest in the first bucket and under-invest in the second, which is not efficient since negative cases are where pagination bugs primarily tend to live.
Accessibility Test Cases for Pagination
Accessible pagination ensures that users who rely on keyboards, screen readers, braille typing and other assistive technologies can navigate through content and understand their current position.
Test whether:
- Users can reach pagination controls using the keyboard.
- Users can move through the controls in a logical order.
- Interactive controls have meaningful, accessible names.
- The current page is programmatically identifiable.
- Disabled controls communicate their state appropriately.
- The pagination navigation has an accessible name when multiple navigation regions exist.
- Focus behavior remains predictable after pagination changes.
- Screen-reader users can understand which page is currently active.
For example:
<nav aria-label="Pagination"> <a href="/products?page=1">1</a> <a href="/products?page=2" aria-current="page">2</a> <a href="/products?page=3">3</a> </nav>
The important test is not simply whether Page 2 looks highlighted. Verify that the current-page state is also exposed programmatically. W3C defines aria-current=”page” specifically for identifying the current page within a set of pages.
How to Write Test Cases for Pagination Functionality
Once the test coverage areas are defined, turn them into test cases using a consistent structure. Writing test cases ensures that users can navigate large datasets smoothly and efficiently.
Here is a step-by-step guide on how to write test cases for pagination functionality:
Step 1: Understand the Pagination Requirements
Before a single test case gets written, pin down the specifics of this implementation:
- How many items load per page by default
- Which controls exist, like next/previous, numbered links, first/last, a manual page-jump field, and an items-per-page selector
- Expected behavior at the boundaries: reaching the first or last page
- How the system should handle an empty dataset or an invalid page number
Step 2: Define the Scope
Split the plan into the two buckets from the previous section:
- Positive scenarios: confirm normal, valid use works as expected
- Negative scenarios: confirm invalid or edge-case input fails safely
Deciding this upfront keeps the suite balanced instead of skewing toward the easy, obvious happy-path checks.
Step 3: Write Test Cases for Positive Scenarios
With scope defined, write out the cases that validate expected behavior under normal conditions. Two that anchor most suites:
- Default page load test: Verify that on first load, the default page (typically Page 1) renders with the correct number of items, matching whatever the default page size is configured to be.
- Items-per-page selector: Change the selector to a different value (say, 10 to 20) and confirm the page re-renders with the new count and the total page number recalculates correctly.
Step 4: Write Test Cases for Negative Scenarios
Now stress test the same flows with invalid or boundary input:
- Clicking Next past the last page
- Entering a page number that doesn’t exist
- Selecting a nonsensical item per page value
- Loading pagination against a dataset with zero results
The goal at this step isn’t creativity; it’s test coverage of every way a user (or a malformed URL) can push the control outside its expected range.
Step 5: Test Edge Cases and Special Scenarios
A final pass covers unusual situations that are neither strictly “positive” nor “negative” but still break implementations in practice:
- Very large datasets that are hard to distribute into even chunks
- Data changing itself, i.e., items added or removed while a user is mid-navigation
- Dynamic data changes or failed pagination requests
- Page size changes or filter/sort changes for a product
- Pagination rendering across different screen sizes, viewports, browsers, and devices
These are the cases that tend to get cut under time pressure and the ones most likely to surface as production bugs later.
Step 6: Organize and Document the Test Cases
Document your test cases and assign them based on the following attributes. Each attribute needs a consistent shape:
| Test case ID | a unique identifier |
|---|---|
| Description | What’s being verified, in one line |
| Preconditions | a seeded dataset, a specific page size, whatever setup the test assumes |
| Test steps | the exact steps to reproduce |
| Expected result | What should happen |
| Actual result | filled in once the test runs |
| Pass/fail criteria | What determines a pass |
Avoid vague expected results such as “Pagination should work correctly.”
Instead, make the expected result observable:
“Page 3 becomes active, displays the expected records for that page, preserves the selected filter, and updates the URL to page=3.”
Organizing and documenting test cases makes it easier for teams to track test coverage, maintain consistency across releases, reproduce failures, and ensure that important test scenarios are not missed.
This is also the point where a shared test management tool can come in to cross-test your app against all mentioned test conditions.
Step 7: Execute and Report Results
Run the suite and close the loop:
- Record what actually happened against each expected result
- Log anything that doesn’t match as a bug, with enough detail to reproduce it
- Retest once a fix lands
- Don’t call the feature done until every case (positive, negative, and edge case) passes cleanly
Treat this as a repeatable cycle, not a one-time checkbox: pagination logic changes often enough (new filters, a new page-size option) that the suite needs to run again on every meaningful change, not just at launch.
Also Read: How to Write Test Cases for Amazon Shopping?
Examples of Writing Test Cases for Pagination Functionality
The following discussion will explore some commonly used scenarios and their corresponding test cases for pagination functionality.
1. Test Case: Verify Default Pagination
Test Case ID: TC_PG_01
Test Case Title: Verify that the default pagination loads correctly with the correct number of items per page.
Pre-Conditions:
- The pagination component is integrated.
- There is a dataset with at least 10 items to paginate through.
- Default page is set to Page 1.
Test Steps:
- Open the web page containing pagination.
- Observe that Page 1 loads successfully.
- Ensure that 10 items (or the expected number) are displayed per page.
Expected Result: Page 1 loads, displaying the correct number of items per page.
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The default page should load, showing the correct number of items per page (e.g., 10). If not, the test fails.
Remarks: N/A
2. Test Case: Verify Navigation to Next Page
Test Case ID: TC_PG_02
Test Case Title: Verify that the Next button moves the user to the next page.
Pre-Conditions:
- At least two pages of data are available (e.g., 10 items per page).
- The current page is Page 1.
Test Steps:
- Click the Next button.
- Observe that the page updates and displays the next set of items.
- Ensure that the page number increments from Page 1 to Page 2.
Expected Result: The next page loads, and the page number updates correctly (from Page 1 to Page 2).
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The page should correctly update to the next set of items and increment the page number. If not, the test fails.
Remarks: N/A
3. Test Case: Verify Navigation to Previous Page
Test Case ID: TC_PG_03
Test Case Title: Verify that the Previous button moves the user to the previous page.
Pre-Conditions:
- The user is on Page 2 or higher.
- Multiple data pages are available (e.g., 10 items per page).
Test Steps:
- Click the Previous button.
- Verify that the page updates and shows the previous set of items.
- Ensure that the page number decreases (e.g., from Page 2 to Page 1).
Expected Result: The previous page is displayed, and the page number should decrement.
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The previous page should load with the correct items, and the page number should decrease. If not, the test fails.
Remarks: N/A
4. Test Case: Verify Page Number Navigation
Test Case ID: TC_PG_04
Test Case Title: Verify that clicking on a specific page number navigates to that page.
Pre-Conditions:
- At least three pages are available for navigation.
Test Steps:
- Click on a specific page number (e.g., Page 3) from the pagination control.
- Observe that the correct items for Page 3 are displayed.
- Ensure that the page number displayed is updated to Page 3.
Expected Result: Page 3 should load correctly, displaying that page’s expected set of items.
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The correct page number should be displayed, and the items should be correct for that page. If not, the test fails.
Remarks: N/A
5. Test Case: Verify the Total Page Count
Test Case ID: TC_PG_05
Test Case Title: Verify that the total number of pages is correctly displayed.
Pre-Conditions:
- The dataset is populated with items, and pagination is enabled.
Test Steps:
- Observe the page number display, which should show the current page and total number of pages.
- Ensure that the correct number of pages is displayed based on the dataset size and items per page.
Expected Result: The total number of pages should match the expected total when calculated based on the dataset size and items per page.
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The total page count should be correct. The test fails if it doesn’t match the dataset size divided by items per page.
Remarks: N/A
6. Test Case: Verify the First and Last Page Buttons
Test Case ID: TC_PG_06
Test Case Title: Verify that the First and Last page buttons work correctly.
Pre-Conditions:
- The user is on a page other than the first or last.
- The pagination component has First and Last buttons.
Test Steps:
- Click the First button and verify that the first page (Page 1) loads correctly.
- Click the Last button and verify that the last page loads correctly.
Expected Result: The “First” button should load Page 1, and the “Last” button should load the last page.
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The correct first and last pages should be loaded when clicking the respective buttons. If not, the test fails.
Remarks: N/A
7. Test Case: Verify Pagination After Deleting Items
Test Case ID: TC_PG_07
Test Case Title: Verify that pagination adjusts correctly after items are deleted.
Pre-Conditions:
- There is a dataset with multiple pages (e.g., 10 items per page).
- The user is on a page with a sufficient number of items to span multiple pages.
Test Steps:
- Delete one or more items from the dataset.
- Verify that the pagination updates reflect the new number of pages.
- Ensure the user is redirected to the last valid page if the current page becomes empty after deletion.
Expected Result: The pagination should update correctly, and the user should not end up on a page that no longer contains items (e.g., if deleting items from the last page, the user should be taken to the previous page).
Actual Result: (To be filled after execution).
Pass/Fail Criteria: The pagination should correctly reflect the changes in the dataset, and the user should be on a valid page. If not, the test fails.
Remarks: N/A
Automating Pagination Tests
Manual execution is fine for the first pass, but pagination is regression-prone. Every change, like filtering, sorting, or the data layer, can quietly break it. It belongs in automated regression testing from day one.
The automation strategy should mirror the manual test strategy:
Action → State change → Data validation → UI validation
Here’s a minimal example verifying that clicking “Next” actually turns the page, using Selenium (Java):
@Test
public void verifyNextPageNavigation() {
driver.get("https://example.com/products");
WebElement currentPageIndicator = driver. findElement(By.cssSelector(".pagination .active"));
String startingPage = currentPageIndicator. getText();
driver.findElement(By.cssSelector("[data-testid='pagination-next']")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.stalenessOf(currentPageIndicator));
WebElement newPageIndicator = driver. findElement(By.cssSelector(".pagination .active"));
Assert.assertNotEquals(startingPage, newPageIndicator. getText(),
"Page indicator did not change after clicking Next");
}The same check in Playwright (TypeScript) is useful when you also want to establish an API call.
test('next button advances page and refetches data', async ({ page }) => {
await page.goto('https://example.com/products');
const [response] = await Promise. all([
page. waitForResponse(res => res.url().includes('/api/products') && res.status() === 200),
page.getByTestId('pagination-next').click(),
]);
await expect(page.getByTestId('current-page')). toHaveText('2');
const body = await response. json();
expect(body.page).toBe(2);
});A few practical notes worth building into your automation strategy, not just your test cases:
- Assert on the network call, not just the DOM. A page indicator that updates visually but is still fetching stale data is a bug your assertions will miss if you only check text on screen.
- Seed test data deterministically: Pagination math (total pages = ceil(items / pageSize)) breaks in subtle ways at boundaries. It might break at exactly 1 item, exactly a full page, or one item over a full page. Seed fixtures that hit these boundaries.
- Run the negative-path tests in CI, not just manually. They’re cheap to automate and catch the exact class of bug (disabled-button logic, URL tampering) that’s easy to regress silently.
Conclusion
By writing test cases for pagination and covering all possibilities (positive, negative, invalid, and edge), you ensure that your users can navigate the website seamlessly without hindrance.
By automating your pagination test cases, you can save a lot of time and ensure your pagination feature works seamlessly across all devices and platforms.
Real-device testing ensures your app doesn’t stop paginating on any new device and functions properly. Choosing a real device lab helps you deliver a smooth experience, no matter what the device or browser is, leading to customer satisfaction.

