Test Cases for Search, Filters, and Pagination

By HiTest
6 min read

Useful test cases for search, filters, and pagination check how the controls work together. A search box can find the right record on page one while dropping its filter on page two. Changing a query from a later page can also produce an apparently empty list because the old page number was retained.

Use a known dataset and write down the expected result set before opening the browser. Without that reference, “results look right” is difficult to review and easy to accept incorrectly.

Build a small dataset with predictable answers

Imagine a project list with a name search, a status filter, a name sort, and a page size of two. Seed these six disposable records in the test workspace:

NameStatus
Cedar AlphaActive
Cedar BetaArchived
Cedar DeltaActive
Cedar GammaActive
Maple AlphaActive
Willow AlphaArchived

For a name query of Cedar, an Active filter, and ascending name sort, the expected results are Cedar Alpha, Cedar Delta, and Cedar Gamma. Page one contains the first two; page two contains Cedar Gamma. The total matching count is three if the product displays such a count.

Those expectations are specific to this illustrative fixture and its agreed name-search behavior. Substitute your application's matching rules, collation, and page size. If page size is fixed, seed enough records to span at least two pages.

Understand the combined result

The Cedar query with the Active filter and ascending sort shows Cedar Alpha and Cedar Delta on page one, then Cedar Gamma on page two.

Open full size

With this example fixture and a page size of two, the three matching records should stay consistent across both pages.

Think of query and filters as defining membership in the result set, sort as defining order, and pagination as selecting a slice. This is a test model, not a requirement about the order of operations inside your implementation.

Search and filter test cases

CaseActionExpected result for the agreed fixture
Query matchSearch for Cedar with no status filterThe four Cedar records are the complete matching set
Exact known recordSearch for a distinctive full nameThe intended record is present according to the matching rule
No matchEnter a query absent from the fixtureA clear no-results state appears without stale rows
Clear queryRemove the queryThe list follows the remaining filters rather than retaining old query results
Filter onlySelect Active without a queryOnly the four active records match
Query plus filterSearch Cedar and select ActiveOnly Cedar Alpha, Cedar Delta, and Cedar Gamma match
Change filterChange Active to Archived while searching CedarThe matching set becomes Cedar Beta
Clear filtersRemove the status constraintThe active query remains applied if controls are independent by design
Supported charactersSearch a separately seeded name with punctuation or UnicodeMatching follows the documented rule and the UI remains usable
Query normalizationTry case or surrounding-space variationsResults match the application's chosen normalization behavior

Include an empty-workspace check separately from a no-results check. A workspace with no records may show an onboarding action; an existing dataset with no matches should help the user adjust their search.

Pagination and sorting test cases

CaseActionExpected result
Next pageUse Cedar, Active, ascending sort, and page size two; open page twoCedar Gamma appears and the query and filter remain active
Previous pageReturn to page oneCedar Alpha and Cedar Delta reappear in the agreed order
Last pageNavigate to the final matching pageNo further valid page is offered or loaded beyond the result boundary
Narrow query on later pageFrom page two, search Cedar AlphaThe page resets or clamps according to policy and shows the valid result
Reverse sortChange ascending to descending name orderThe complete matching set remains the same and the visible slice changes correctly
Page-size changeIf supported, change the size while on a later pageNavigation and visible rows follow the documented reset or position rule
Browser backChange query or page, then navigate backState restoration matches the product's navigation contract
ReloadReload a filtered listQuery, filters, sort, and page follow the documented persistence policy
Shared URLIf URL state is supported, open the list URL in another sessionSupported state is restored, subject to the second account's access
Delete last rowRemove the only row on the final page using disposable dataThe list moves or refreshes coherently instead of leaving an unexplained invalid page

URL persistence is a product capability to test when offered, not a universal prerequisite for every list. Likewise, do not write a test that assumes arbitrary page-number access when the interface uses cursors or a load-more button.

Watch for stale results during rapid changes

In a controlled test environment, change a query while a previous request is still pending. The final visible result should correspond to the current controls, even if responses arrive in a different order. Check the displayed rows and loading state after the interface settles.

This is best paired with a component or integration test that can control response timing. A browser case alone may not reliably reproduce the race. Record whether the condition was actually exercised rather than claiming coverage from a normal fast run.

For large lists, verify ordering around page boundaries with stable fixture data. If records can have equal sort values, define the product's tie behavior before asserting an exact order. Concurrent changes can otherwise make a reasonable result look like a defect.

Write a browser case with exact expectations

A useful case for the example dataset is: open projects, query Cedar, select Active, sort ascending, verify Cedar Alpha and Cedar Delta, move to page two, and verify Cedar Gamma. Assert that Cedar Beta is absent from the matching results and that the Active control remains selected.

Represent that specification in HiTest as separate actions and expected results, using a test account scoped to the seeded workspace. Keep fixture creation and cleanup explicit.

Add the most important combined-state case to the release smoke group only if list behavior is essential to the product. Keep the wider matrix in the regression plan.

Frequently asked questions

Should search, filters, and pagination be tested separately?

Test each control's basic behavior and add combined-state cases. The interaction cases catch dropped filters, stale page positions, and inconsistent ordering that isolated checks miss.

How much test data is enough?

Prepare enough known records to create matches, nonmatches, at least two pages, and a partial final page. Add duplicate sort values or special-character names when those behaviors matter.

What should happen when a filter leaves the current page empty?

Define whether the application resets, clamps, or otherwise navigates to a valid result position. Then test that rule explicitly and distinguish it from a genuine no-results state.