Skip to content
QA Knowledge Hub

Test cases for filters and sorting on an e-commerce listing

Updated 2026-11-13 · 6 min read

These 30 cases use explicit test fixtures and checkable outcomes. Cover normal behavior, boundaries, recovery, security and usability, then adapt the requirements to your product.

How to answer in an interview

Ask whether choices within a facet use OR, whether different facets use AND, what price means, and how ties are ordered. Demonstrate a small dataset whose expected IDs you can calculate by hand. Checking only that a filter chip appears misses incorrect server-side selection.

Scope and test data

These 30 cases use a fictional catalogue: A is a red cotton shirt at ₹500, B a blue cotton shirt at ₹500, C a red wool shirt at ₹900, and D a red cotton shoe at ₹1,200. A, B and D are in stock; C is out of stock. Product IDs break price ties in ascending order. Prices are final displayed item prices, excluding delivery.

The example contract uses OR within a facet, AND between facets, inclusive price bounds, immediate application, a page-1 reset after changes, and a Clear all action that preserves sort. Replace those choices when the product specification differs. Add enough extra seeded products for pagination tests and record their expected IDs before execution.

These are proposed manual test cases, not an execution report. Run security and load checks only in an authorised isolated environment. Record agreed limits before execution; a case without its required limit is not ready to pass or fail.

Matching and price boundaries

IDCategoryTest caseExpected result
F01FunctionalSelect red onlyA, C and D appear; B is excluded
F02FunctionalSelect red and blue within colourA, B, C and D appear once each
F03FunctionalSelect red and cottonOnly A and D appear
F04FunctionalSelect red and shirt categoryOnly A and C appear
F05FunctionalAdd in-stock to red shirtsOnly A remains
F06FunctionalRemove red while keeping cotton and in-stockA, B and D appear
F07FunctionalClear all after applying several filtersAll four products return; chips clear and sort remains selected
F08BoundarySet price range ₹500 to ₹900A, B and C appear, including both endpoints
F09BoundarySet both price bounds to ₹500Only A and B appear
F10NegativeSet minimum price higher than maximumAn inline range error appears; invalid bounds are not applied

Sorting and navigation

IDCategoryTest caseExpected result
F11FunctionalSort price low to highOrder is A, B, C, D
F12FunctionalSort price high to lowOrder is D, C, A, B under the declared ID tie-break rule
F13FunctionalFilter cotton then sort high to lowOrder is D, A, B; wool product C stays excluded
F14FunctionalPaginate a larger filtered catalogue in price orderEvery page continues the global order; there are no duplicates in a frozen dataset
F15FunctionalChange a filter while on page 3Page resets to 1 with the new matching total
F16FunctionalRefresh a URL containing colour, price and sortControls, chips and results restore the same selection
F17FunctionalOpen a product and use BackApplied filters and sort are retained
F18FunctionalUse browser Back after changing red to bluePrior red selection and its result set return
F19NegativeUse a combination with no matchesZero-results message shows the active filters and a working clear action
F20NegativeOpen a URL with an unknown sort or facet valueUnsupported values produce the documented validation or default state; controls and results agree

Resilience and quality attributes

IDCategoryTest caseExpected result
F21FunctionalChange red to blue while red's request is delayedOnly B is shown when blue completes; late red results cannot overwrite it
F22NegativeFail a filter requestA retry state appears; old results are not presented as matching the new filter
F23SecurityRequest a hidden product through a facet or sort parameterNeither its card nor its private metadata or facet count is exposed
F24SecuritySend an unrecognised field name as a sort keyServer rejects or safely defaults; no internal query details leak
F25BoundaryEnter a negative or nonnumeric priceField error explains the accepted range or format; no broken listing appears
F26UIOperate facets, chips and sort using only keyboardSelections are reachable, visible and removable without a pointer
F27UIChange filters with a screen reader activeSelected states and updated result-count status are available to assistive technology
F28CompatibilityApply the same selections in desktop and mobile filter panelsBoth produce the same IDs; reopening the panel shows applied values
F29PerformanceMeasure filter-to-results time for high-cardinality facets under agreed loadMeasured latency meets the recorded budget; loading status remains visible
F30FunctionalUpdate a product's stock, then reapply in-stock filterResults and count reflect the same documented freshness window

What makes a useful defect report

Include the catalogue snapshot, selected facets, expected IDs, actual IDs and sort key. “Wrong sort” is weaker evidence than “B appears after C even though ₹500 precedes ₹900.” Agree on whether unavailable facet choices stay visible and whether their counts describe the current intersection or a potential expanded selection; neither design is universal.

For an interview follow-up about discounts, ask whether sorting uses the original price, the discounted price or a personalised price. Keep currency and price visibility consistent before comparing values.

Downloads

Quick answers

Should sorting happen before pagination?

The displayed pages must represent a globally sorted result set. Sorting only the items already fetched for one page fails that requirement.

Are multiple filters always combined with AND?

No. Many catalogues use OR within a facet and AND across facets, but the expected IDs must come from the agreed rules.

Sources

Want a project you can show in interviews?

The portfolio project kit walks you through testing a deliberately buggy app with Selenium or Playwright and API tests, then explaining it. The app itself is free.