Back to guides

GUIDE / manual

Test Cases for Search Functionality

Practical test cases for search functionality: relevance, filters, no-results, typos, ranking, performance, and ecommerce search QA examples.

By The Testing AcademyPublished July 9, 2026Updated July 9, 202618 min read

Good test cases for search functionality go far beyond typing a word and checking that a page reloads. Search is a product feature with ranking, relevance, indexing lag, filters, permissions, language behavior, and empty states. When search is weak, users cannot find value that already exists. When search is wrong, users lose trust in the catalog, knowledge base, or app content.

This guide gives you a complete approach to designing search test cases for websites and apps, including ecommerce, content portals, and SaaS record search. You will get scenario maps, sample cases, relevance golden sets, filter matrices, security checks, and prioritization guidance.

What Search Functionality Includes

A typical search system has multiple layers:

  1. Input box UX and validation.
  2. Query parsing and normalization.
  3. Retrieval against an index or database.
  4. Ranking and relevance logic.
  5. Filters, facets, and sort.
  6. Result rendering and pagination.
  7. No-result and error states.
  8. Analytics events.
  9. Permissions and visibility rules.
  10. Performance and resiliency.

If you only test layer 1 and 6, you will miss the expensive defects.

Clarify Search Requirements First

Before writing cases, answer:

  • What entities are searchable (products, articles, users, orders)?
  • Which fields are indexed (title, SKU, tags, body, metadata)?
  • Is search exact, prefix, fuzzy, or boolean?
  • Are synonyms supported?
  • Is ranking personalized?
  • How fresh is the index after catalog updates?
  • Are results permission-filtered?
  • Do filters use AND or OR semantics?
  • Is the empty query allowed, blocked, or shows popular items?
  • Are there language or locale specific analyzers?

Write unknowns as open questions. Search bugs often come from unspoken ranking assumptions. For general case writing structure, use how to write test cases.

Test Cases for Search Functionality: Scenario Map

Core retrieval scenarios

  • Exact match on title.
  • Exact match on ID/SKU.
  • Partial token match.
  • Multi-word query.
  • Case variation.
  • Extra whitespace.
  • Leading/trailing spaces.
  • Stop words if language analysis applies.
  • Synonym match if configured.
  • Obsolete or unpublished item exclusion.

UX scenarios

  • Empty submit.
  • Query at max length.
  • Clear search control.
  • Recent searches if present.
  • Suggestions/autocomplete.
  • Keyboard navigation through suggestions.
  • Clicking a suggestion.

Zero and low result scenarios

  • Truly unknown term.
  • Misspelling with and without fuzzy matching.
  • Valid term filtered to zero by facets.
  • Query with only special characters.

Facet and sort scenarios

  • Single filter.
  • Multiple filters.
  • Sort by price/relevance/newest.
  • Filter then sort.
  • Sort then filter.
  • Clear all.

Authorization scenarios

  • Public user does not see private docs.
  • Role A does not see role B records.
  • Logged-out vs logged-in result differences if intended.

Resilience scenarios

  • Slow responses show loading state.
  • Backend error shows recoverable message.
  • Very long query handled safely.

Search Input Test Cases

Search starts as a text field. Reuse discipline from test cases for a text field, then add search-specific expectations.

IDTitleInputExpected
TC-SEARCH-001Valid keyword returns resultswireless headphonesRelevant results rendered
TC-SEARCH-002Empty query behaviorblank submitBlocked, popular items, or all-items per rule
TC-SEARCH-003Whitespace only Treated as empty per rule
TC-SEARCH-004Leading/trailing spaces shoes Same as shoes if trimmed
TC-SEARCH-005Case insensitivityShoes vs shoesEquivalent results for normal catalog search
TC-SEARCH-006Max length queryexact max charsHandled without crash
TC-SEARCH-007Over max lengthmax+1Rejected or truncated per rule
TC-SEARCH-008Special charactersC++, AT&T, #1Sensible matches or safe empty, no error page
TC-SEARCH-009SQL-like string' OR '1'='1No bypass, safe handling
TC-SEARCH-010XSS payload query<script>alert(1)</script>Escaped in UI, no execution

Detailed example:

Test Case ID: TC-SEARCH-004
Title: Verify search trims outer spaces before querying
Priority: Medium
Preconditions: Catalog contains products matching "mug"
Test Data: "  mug  "
Steps:
  1. Open page with search box.
  2. Enter "  mug  ".
  3. Submit search.
Expected Result:
  - Results equivalent to query "mug".
  - No zero-result solely due to spaces.
  - Query display may show trimmed value.

Relevance and Ranking Test Cases

Returning results is not enough. The right results must rank well.

Build a golden query set

Create a table of business-critical queries:

QueryMust appear in top NMust not appearNotes
exact product nameTop 3Discontinued SKUExact title boost
popular brand + categoryTop 10Unrelated category
SKU codeTop 1Exact ID lookup
common synonymTop 10e.g., sofa vs couch if synonymized
competitor misspellingTop 10 if fuzzy onOptional
IDTitleExpected
TC-SEARCH-020Exact title ranks highKnown product in top 3
TC-SEARCH-021SKU exact match firstExact SKU product is first
TC-SEARCH-022Synonym supportConfigured synonym returns targets
TC-SEARCH-023Unpublished item excludedDraft/hidden item not shown publicly
TC-SEARCH-024Out of stock ranking policyMatches config (included/demoted/hidden)
TC-SEARCH-025Stop-word heavy queryStill returns useful matches if intended

Relevance judgments should be reviewed with product and merchandising, not only QA opinion.

Partial Match, Tokenization, and Language Cases

IDTitleExampleExpected direction
TC-SEARCH-030Prefix matchhead finds headphones if prefix enabledMatch policy
TC-SEARCH-031Multi-word all tokensred running shoesResults relate to combined intent
TC-SEARCH-032Word order variationshoes running redAcceptable if unordered tokens allowed
TC-SEARCH-033Hyphenationt-shirt vs tshirtPer analyzer rules
TC-SEARCH-034Accent insensitivitycafe vs caféEquivalent if configured
TC-SEARCH-035Locale-specific analysislanguage-specific stemmingCorrect for selected locale

Document analyzer expectations. Otherwise testers and developers argue endlessly about "should run match running?"

No Results and Recovery UX

IDTitleExpected
TC-SEARCH-040Unknown term empty stateClear no-results message
TC-SEARCH-041Suggestions for likely typoDid-you-mean if feature exists
TC-SEARCH-042Recommendations on emptyLabeled as popular/recommended, not as matches
TC-SEARCH-043Keep query visibleUser can edit query easily
TC-SEARCH-044Zero results with active filtersMessage indicates filters may be too narrow, easy clear

Bad empty states look like broken pages. Good empty states recover conversion.

Autocomplete and Suggestions

If search has typeahead:

IDTitleExpected
TC-SEARCH-050Suggestions appear after thresholdShows after N characters per rule
TC-SEARCH-051Keyboard navigate suggestionsArrow keys move, enter selects
TC-SEARCH-052Mouse select suggestionNavigates to result or fills query
TC-SEARCH-053Debounced requestsNo excessive spam of API calls on every key (observability check)
TC-SEARCH-054Suggestion permission filterNo private titles leaked in suggestions
TC-SEARCH-055Esc closes suggestion listFocus remains usable

Filters, Facets, and Sort Matrices

Faceted search defects are common in ecommerce and catalog apps. For broader store coverage, pair with test cases for ecommerce website.

Single filter cases

IDTitleExpected
TC-SEARCH-060Filter by brandOnly that brand
TC-SEARCH-061Filter by price rangeAll visible items within range
TC-SEARCH-062Filter by ratingMatches threshold rule
TC-SEARCH-063Filter by availabilityIn-stock only if selected

Combined filters

IDTitleExpected
TC-SEARCH-064Brand + sizeAND semantics if that is the rule
TC-SEARCH-065Two values in same facetOR within facet if standard ecom pattern
TC-SEARCH-066Conflicting filters to zeroEmpty state, not error
TC-SEARCH-067Remove one filterResults expand correctly
TC-SEARCH-068Clear all filtersBack to base query results

Sort cases

IDTitleExpected
TC-SEARCH-070Sort price low to highNon-decreasing prices
TC-SEARCH-071Sort price high to lowNon-increasing prices
TC-SEARCH-072Sort newestDate order correct
TC-SEARCH-073Sort relevance defaultDefault selected on new query
TC-SEARCH-074Sort preserved with filter changePer product design

URL and shareability

If filter state is in the URL:

  • Copy URL in new session restores same results.
  • Back button restores previous filter state.
  • Manual URL edit with invalid facet fails safely.

Pagination and Result Stability

IDTitleExpected
TC-SEARCH-080Page 2 loads next setNo duplicate of page 1 items
TC-SEARCH-081Last page partial fillRenders remaining items
TC-SEARCH-082Infinite scroll load moreAppends without duplicates
TC-SEARCH-083Result count accuracyCount matches policy (exact or approximate label)
TC-SEARCH-084Stable sort tiesDeterministic secondary key if required

Unstable ordering makes automation flaky and users confused.

Index Freshness and Catalog Update Cases

Search quality depends on indexing.

IDTitleExpected
TC-SEARCH-090New product becomes searchable within SLAAppears by promised time
TC-SEARCH-091Title update reflectedNew title matches, old title behavior per design
TC-SEARCH-092Unpublished product disappearsNot returned after unpublish propagation
TC-SEARCH-093Price update reflectedResult card shows updated price after refresh SLA
TC-SEARCH-094Deleted product removedNo dead result links, or soft handling

If SLA is 5 minutes, your expected result must include timing context. Immediate consistency is not always required, but it must be known.

IDTitleExpected
TC-SEARCH-100Private document not in public searchHidden
TC-SEARCH-101User finds own order by IDFound for owner
TC-SEARCH-102User cannot find others' order by IDNot found or denied
TC-SEARCH-103Personalized boost does not leak dataOnly allowed items boosted
TC-SEARCH-104Admin search wider scopeAdmin sees allowed operational fields only

Authorization bugs in search are data breaches waiting to happen.

Performance and Resilience Cases

You may not run full load tests in a functional suite, but include smoke expectations.

IDTitleExpected
TC-SEARCH-110Common query responds within targete.g., under agreed threshold on staging baseline
TC-SEARCH-111Loading indicator for slow queryUser sees progress, can cancel if supported
TC-SEARCH-112Backend 500 handlingFriendly error, retry path
TC-SEARCH-113No results still fastEmpty state not a hang
TC-SEARCH-114Heavy facet combinationNo crash, acceptable degradation

Record environment notes. Performance assertions without baselines create arguments.

Analytics and Instrumentation Cases

If search metrics matter to the business:

  • Search submitted event fires once.
  • Zero result event fires on empty.
  • Suggestion click tracked distinctly from manual submit.
  • Filter applied events include facet ids.

Broken analytics make product teams fly blind even when UI works.

Special Domains

Ecommerce search extras

  • Search by SKU, barcode, brand, category synonyms.
  • Merchandising pins/boosts for campaigns.
  • Exclude products not sellable in current region.
  • Currency and catalog differences by market.

SaaS app record search extras

  • Search operators (from:, status:) if supported.
  • Saved searches.
  • Recent records.
  • Field-scoped search.

Help center / content search extras

  • Heading vs body boosts.
  • Locale-specific content only.
  • Attachments searchable or not.

Boundary Ideas for Search Queries

From boundary value analysis and equivalence partitioning:

  • 0 chars, 1 char, minimum suggestion threshold, max length, max+1.
  • Single character queries if allowed (a) can stress the system.
  • Multi-byte unicode characters counting toward max length.
  • Extremely high page numbers (page=999999).
IDTitleExpected
TC-SEARCH-120One character queryPer rule: blocked, suggestions, or broad results
TC-SEARCH-121Huge page numberEmpty safe state or redirect to last page
TC-SEARCH-122Negative page numberSafe rejection

Sample Golden Mini Suite

  1. Exact product/content title match ranks high.
  2. Case insensitive equivalence.
  3. Trimmed spaces equivalence.
  4. SKU/ID exact match.
  5. Unknown term empty state.
  6. XSS query escaped.
  7. Brand filter AND query works.
  8. Price sort ascending correct.
  9. Page 2 has no duplicates.
  10. Private item not visible to unauthorized user.
  11. New item searchable within SLA.
  12. Autocomplete keyboard selection works.

These twelve cases catch a surprising percentage of production search complaints.

Mistake 1: Checking only that results are non-empty

Irrelevant non-empty results are still failures.

Mistake 2: No golden set

Without expected top results, relevance debates never end.

Mistake 3: Ignoring filters after query

Most real users combine query + facets.

Mistake 4: Forgetting permissions

Search is an easy accidental data leak surface.

Mistake 5: Testing only perfect spelling

Users misspell constantly. If fuzzy is promised, test it. If not, confirm empty states are good.

Mistake 6: Unclear freshness expectations

Testers report bugs for index lag that is actually within SLA, or miss real stale index bugs.

Mistake 7: Flaky automation on personalized ranking

Personalization and A/B ranking need fixtures or else automation becomes noisy.

Mistake 8: No mobile search UX cases

Small screens hide suggestions, filters, and clear buttons differently.

Weak:

Search works.

Stronger:

For query blue ceramic mug, product SKU MUG-BLUE-01 appears in the top 3 results, all visible items contain blue or mug relevance signals per business rules, result prices match PDP for the same SKU, and result links open the correct PDP.

Include:

  • What must appear.
  • Where it should rank if critical.
  • What must not appear.
  • What the empty state should show.
  • How filters alter the set.

Automation Strategy

Good automation candidates:

  • Deterministic ID/SKU exact match.
  • Case and trim normalization.
  • Filter application with seeded catalog.
  • Authz: private doc excluded.
  • XSS escaped rendering smoke.
  • Pagination duplicate checks on stable sort.

Harder to automate without help:

  • Subjective relevance quality.
  • Merchandising boosts that change weekly.
  • Personalized results.

Use seeded indexes in test environments. Do not point relevance automation at a constantly changing production catalog without stable fixtures.

Practice Exercise

Pick a live public store or content site and in 45 minutes:

  1. List 15 real queries users would type.
  2. Mark expected first result for 5 of them.
  3. Execute those 5 and note ranking misses.
  4. Apply two filters and re-check counts.
  5. Force a no-results query and critique the empty state.
  6. Convert findings into 8 formal test cases.

For competitive practice writing tight scenarios quickly, use QABattle battles and then formalize your notes into a search suite.

Review Checklist

  • Input normalization covered.
  • Exact and partial match covered.
  • Relevance golden queries exist for critical terms.
  • Empty state covered.
  • Filters and sort covered.
  • Pagination stability covered.
  • Permissions covered.
  • Index freshness expectations documented.
  • Security samples covered.
  • Mobile and autocomplete covered if present.
  • Analytics smoke considered if business critical.
  • Priority labels match user impact.

Worked Example: Building a Search Suite for a Catalog App

Imagine a mid-size ecommerce catalog with 12,000 SKUs, brand and size facets, synonym support for a few merchandising terms, and a five-minute index lag SLA. Here is how a practical suite comes together in one afternoon.

Step 1: Write the search contract

Searchable fields: title, brand, SKU, category, top tags
Default sort: relevance
Facet semantics: AND across facets, OR within multi-select brand
Empty query: blocked with helper text
Fuzzy: on for edit distance 1 after 4 characters
Synonyms: sofa=couch, TV=television
Private drafts: excluded from public search
Index lag SLA: 5 minutes for publish/unpublish

Step 2: Seed known products

Create or identify fixtures:

SKUTitleBrandNotes
SOFA-001Nord Cloud SofaNordsynonym target for couch
TV-55-OLED55 inch OLED TelevisionViewMaxsynonym target for TV
MUG-BLUE-01Blue Ceramic MugHomeCoexact match staple
DRAFT-999Secret Draft ChairHiddenCounpublished

Step 3: Author the first 15 cases

  1. Exact title Blue Ceramic Mug ranks MUG-BLUE-01 in top 3.
  2. SKU MUG-BLUE-01 returns that product first.
  3. Query couch returns SOFA-001 via synonym.
  4. Query tv oled returns TV-55-OLED in top results.
  5. Case variants of mug are equivalent.
  6. Outer spaces around mug are equivalent.
  7. Query zzzznotaproduct shows empty state.
  8. XSS query is escaped in results UI.
  9. Brand filter HomeCo + query mug keeps only HomeCo mugs.
  10. Price ascending sort is monotonic on visible items.
  11. Page 2 has no page 1 duplicates under price sort.
  12. DRAFT-999 never appears for public user.
  13. Newly published product appears within 5 minutes.
  14. Unpublished product disappears within 5 minutes.
  15. Autocomplete keyboard select navigates correctly.

Step 4: Execute and score

Track pass/fail and also a simple relevance score for golden queries:

QueryTop result OK?Notes
Blue Ceramic MugYes/No
MUG-BLUE-01Yes/No
couchYes/Nosynonym
tv oledYes/Nomulti-token

If synonym fails, that is not "search broken globally." It is a specific configuration defect. Good cases make that diagnosis obvious.

Step 5: Promote survivors into regression

Any failed production search complaint should become a golden query with a permanent case ID and owner. Search suites improve when they absorb real user language, not only tidy QA language.

Search Test Case Template You Can Reuse

Test Case ID:
Title:
Requirement Reference:
Priority:
Type: Functional | Relevance | Facet | Security | Permission | Performance smoke
Preconditions: index state, user role, locale, feature flags
Query:
Filters/Sort:
Test Data / Expected entities:
Steps:
Expected Result:
  - must include:
  - must exclude:
  - ranking note:
  - empty state note:
Actual Result:
Status:
Notes: index time, personalization off/on

Using a dedicated "must include / must exclude / ranking note" block prevents vague expected results.

How Search Fits Release Gates

Not every release needs the full relevance lab. Use layered gates:

GateWhenSuite slice
PR smokesearch code changesexact ID match, empty query rule, one filter
Nightlymain branchgolden top 20 queries, facet matrix sample, authz
Pre-releasemarketing eventsmerchandising pins, campaign synonyms, mobile UX
Post-incidentranking bug escapednew golden queries plus related regression

This keeps test cases for search functionality maintainable instead of turning into an unprioritized pile.

Collaboration Tips With Product and Engineering

Search quality is shared ownership.

  • Product defines business-critical queries and synonym intent.
  • Engineering explains analyzer behavior and index lag.
  • QA turns those into executable cases and evidence.
  • Merchandising validates boost and pin expectations during campaigns.

A short weekly 20-minute search triage on zero-result analytics often yields better suite growth than writing cases in isolation. Pull top failed queries from analytics, convert them into cases, and re-check after ranking changes.

Conclusion

Effective test cases for search functionality validate that users can find the right things quickly, safely, and consistently. Cover query handling, relevance, facets, empty states, permissions, and freshness, not just the presence of a results list. Build a golden query set for business-critical terms, assert precise expected results, and keep a fast smoke pack for release gates.

Search is often the difference between a rich catalog and a usable product. When your suite protects both retrieval correctness and ranking usefulness, you protect discovery, conversion, and trust in one place.

FAQ

Questions testers ask

What are the key test cases for search functionality?

Cover valid keyword matches, partial matches, case insensitivity, no-results behavior, empty query handling, filters and sort interaction, result accuracy against source data, special characters, and performance under normal load. Add typo tolerance, synonyms, and ranking checks when the product promises them.

How do you test search relevance?

Build a golden query set with expected top results, then judge whether the best match appears near the top. Compare exact title matches, popular items, and synonym cases. Relevance is not only 'some results returned.' It is whether useful results rank correctly for real user queries.

What should happen when search returns no results?

Users should see a clear empty state, optionally spelling suggestions, popular or nearby categories, and an easy way to edit the query. The page should not look broken, show null errors, or display unrelated products as if they matched unless labeled as recommendations.

How do you test search with filters and sort?

Apply each filter alone, combine filters, change sort after filtering, remove filters, and verify counts. Confirm URL state if shareable, and ensure filter options do not include impossible combinations that yield silent zero results without explanation.

Should search be case sensitive?

For most product and content search experiences, queries should be case insensitive. Test `Shoe`, `shoe`, and `SHOE` for equivalent results unless the domain intentionally requires case sensitivity, such as some code or ID search tools.

What security tests apply to search boxes?

Try XSS payloads in queries and ensure results pages escape output. Check that unauthorized users cannot surface private records through search. Very long queries should not crash the service. SQL-like strings must not bypass authorization or expose schema errors.