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
| ID | Category | Test case | Expected result |
|---|---|---|---|
| F01 | Functional | Select red only | A, C and D appear; B is excluded |
| F02 | Functional | Select red and blue within colour | A, B, C and D appear once each |
| F03 | Functional | Select red and cotton | Only A and D appear |
| F04 | Functional | Select red and shirt category | Only A and C appear |
| F05 | Functional | Add in-stock to red shirts | Only A remains |
| F06 | Functional | Remove red while keeping cotton and in-stock | A, B and D appear |
| F07 | Functional | Clear all after applying several filters | All four products return; chips clear and sort remains selected |
| F08 | Boundary | Set price range ₹500 to ₹900 | A, B and C appear, including both endpoints |
| F09 | Boundary | Set both price bounds to ₹500 | Only A and B appear |
| F10 | Negative | Set minimum price higher than maximum | An inline range error appears; invalid bounds are not applied |
Sorting and navigation
| ID | Category | Test case | Expected result |
|---|---|---|---|
| F11 | Functional | Sort price low to high | Order is A, B, C, D |
| F12 | Functional | Sort price high to low | Order is D, C, A, B under the declared ID tie-break rule |
| F13 | Functional | Filter cotton then sort high to low | Order is D, A, B; wool product C stays excluded |
| F14 | Functional | Paginate a larger filtered catalogue in price order | Every page continues the global order; there are no duplicates in a frozen dataset |
| F15 | Functional | Change a filter while on page 3 | Page resets to 1 with the new matching total |
| F16 | Functional | Refresh a URL containing colour, price and sort | Controls, chips and results restore the same selection |
| F17 | Functional | Open a product and use Back | Applied filters and sort are retained |
| F18 | Functional | Use browser Back after changing red to blue | Prior red selection and its result set return |
| F19 | Negative | Use a combination with no matches | Zero-results message shows the active filters and a working clear action |
| F20 | Negative | Open a URL with an unknown sort or facet value | Unsupported values produce the documented validation or default state; controls and results agree |
Resilience and quality attributes
| ID | Category | Test case | Expected result |
|---|---|---|---|
| F21 | Functional | Change red to blue while red's request is delayed | Only B is shown when blue completes; late red results cannot overwrite it |
| F22 | Negative | Fail a filter request | A retry state appears; old results are not presented as matching the new filter |
| F23 | Security | Request a hidden product through a facet or sort parameter | Neither its card nor its private metadata or facet count is exposed |
| F24 | Security | Send an unrecognised field name as a sort key | Server rejects or safely defaults; no internal query details leak |
| F25 | Boundary | Enter a negative or nonnumeric price | Field error explains the accepted range or format; no broken listing appears |
| F26 | UI | Operate facets, chips and sort using only keyboard | Selections are reachable, visible and removable without a pointer |
| F27 | UI | Change filters with a screen reader active | Selected states and updated result-count status are available to assistive technology |
| F28 | Compatibility | Apply the same selections in desktop and mobile filter panels | Both produce the same IDs; reopening the panel shows applied values |
| F29 | Performance | Measure filter-to-results time for high-cardinality facets under agreed load | Measured latency meets the recorded budget; loading status remains visible |
| F30 | Functional | Update a product's stock, then reapply in-stock filter | Results 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.
