Skip to content
All notes
43Scenario-BasedScenario-BasedTest Cases

Write test cases for a search functionality on an e-commerce website

Functional Test Cases

TC01: Search with Valid Product Name

  • Precondition: User is on homepage
  • Steps: Enter “iPhone 15” in search box, Click search
  • Expected: Display relevant iPhone 15 products

TC02: Search with Partial Product Name

  • Steps: Enter “iPho” in search box
  • Expected: Display auto-suggestions with iPhone products

TC03: Search with Non-Existent Product

  • Steps: Enter “xyz123abc” in search box
  • Expected: Display “No results found” message with suggestions

TC04: Search with Empty Input

  • Steps: Click search without entering text
  • Expected: Display validation message or show popular products

TC05: Search with Special Characters

  • Steps: Enter “@#$%” in search box
  • Expected: Handle gracefully, show no results or error message

TC06: Search with Category Filter

  • Steps: Search “shoes”, apply “Men’s” category filter
  • Expected: Display only men’s shoes

TC07: Search with Price Range Filter

  • Steps: Search “laptop”, set price range $500-$1000
  • Expected: Display laptops within price range

TC08: Search Result Sorting

  • Steps: Search “headphones”, sort by “Price: Low to High”
  • Expected: Results sorted by ascending price

TC09: Search with Misspelled Word

  • Steps: Enter “ipone” instead of “iphone”
  • Expected: Show “Did you mean: iPhone?” suggestion

TC10: Search History

  • Steps: Perform multiple searches, click search box again
  • Expected: Display recent search history

Performance Test Cases

  • TC11: Search response time should be < 2 seconds
  • TC12: Auto-suggestions should appear within 500ms
  • TC13: Search should handle 1000 concurrent users

UI/UX Test Cases

  • TC14: Search box is visible on all pages
  • TC15: Search icon is clickable
  • TC16: Enter key triggers search
  • TC17: Search results display product image, name, price
  • TC18: Pagination works correctly for large result sets

Security Test Cases

  • TC19: Test SQL injection in search input
  • TC20: Test XSS attacks in search query