E-Commerce Architecture

E-commerce platforms are among the most complex web applications, combining catalog management, real-time inventory, payment processing, and logistics into a seamless customer experience. Every bug in the purchase flow directly translates to lost revenue.

Core Components

  • Product Catalog: Product data, categories, attributes, images, pricing, and variants (size, color)
  • Search Engine: Product search with relevance ranking, filters, faceted navigation, and autocomplete
  • Shopping Cart: Temporary storage of selected items with quantity, pricing, and discount calculations
  • Checkout: Multi-step process: address, shipping method, payment, order confirmation
  • Payment Processing: Integration with payment gateways (Stripe, PayPal, Adyen) for card and alternative payments
  • Order Management: Order lifecycle from placement through fulfillment, shipping, and returns
  • Inventory Management: Stock levels, warehouse allocation, backorder handling

Critical E-Commerce Test Scenarios

Cart Operations

The shopping cart is the bridge between browsing and buying:

ScenarioExpected Behavior
Add itemCart updates count, shows item, calculates subtotal
Update quantityPrice recalculates, inventory check validates availability
Remove itemItem removed, totals recalculate, empty cart state handled
Cart merge on loginGuest cart merges with saved cart, conflicts resolved
Cart expirationItems released back to inventory after timeout
Price changeCustomer notified if price changed since adding to cart

Checkout Flow

graph LR A[Browse] --> B[Search] B --> C[Product Page] C --> D[Add to Cart] D --> E[Cart Review] E --> F[Checkout] F --> G[Payment] G --> H[Order Confirmation] H --> I[Fulfillment] I --> J[Delivery] J --> K[Returns]

Test the complete flow for:

  • Guest checkout vs. registered user checkout
  • Address validation and suggestions
  • Multiple shipping methods with correct pricing
  • Discount code application (single, stacking rules)
  • Payment with 3D Secure authentication
  • Order confirmation email with correct details

Inventory Management

Preventing overselling requires testing concurrent scenarios:

Scenario: Last item in stock
- User A adds item to cart
- User B adds same item to cart
- User A completes checkout
- User B attempts checkout → should fail with "out of stock" message

Search and Discovery Testing

Product search directly affects conversion rates:

  • Relevance: Search for “red dress” returns red dresses, not red shoes or blue dresses
  • Typo tolerance: “iphon” should still find iPhone products
  • Filters: Category, price range, brand, size, color — all combinations work correctly
  • Sorting: Price low-to-high, rating, newest, best-selling — all produce correct order
  • Empty results: Helpful message with suggestions, not a dead end

Advanced E-Commerce Testing

Flash Sale and High Traffic Testing

Flash sales create extreme concurrency:

  • Thousands of users attempting to buy limited inventory simultaneously
  • Payment gateway must handle the spike without timeouts
  • Inventory must be accurately tracked under extreme load
  • Queue management for fair access when demand exceeds supply

Cross-Border Commerce

International e-commerce adds complexity:

  • Multi-currency pricing and conversion
  • Customs duties and import tax calculations
  • Restricted products by country
  • International shipping options and tracking
  • Localized payment methods (iDEAL in Netherlands, PIX in Brazil)

Subscription Commerce

Recurring purchases have unique testing needs:

  • Subscription creation, modification, and cancellation
  • Recurring payment processing and failure handling
  • Delivery schedule management
  • Price change notifications for existing subscribers

Hands-On Exercise

Design an end-to-end test plan for a checkout flow:

  1. Guest checkout: Complete purchase without account, verify order confirmation
  2. Address validation: Test invalid addresses, PO boxes, international addresses
  3. Shipping methods: Verify pricing for standard, express, and same-day delivery
  4. Discount codes: Apply valid code, expired code, minimum purchase requirement not met
  5. Payment: Test successful payment, declined card, 3D Secure challenge
  6. Order confirmation: Verify email with correct items, prices, shipping address, and estimated delivery
Solution Guide

Guest checkout tests:

  • Complete purchase with valid data — verify order created
  • Navigate away during checkout and return — verify cart preserved
  • Verify guest can track order via email link without account

Discount code tests:

  • Valid 20% code on $100 order: verify $80 total
  • Expired code: clear error message, original price maintained
  • Minimum $50 code on $30 order: error explaining minimum not met
  • Two codes: verify stacking rules (allowed or “one code per order”)

Payment tests:

  • Successful Visa payment: order confirmed, inventory decremented
  • Declined card: clear error, order not created, inventory not decremented
  • 3D Secure: complete challenge, verify order creation after authentication

Pro Tips

  1. Test the cart across sessions and devices — cart merge on login is a common bug source
  2. Verify inventory is reserved at checkout, not just at cart addition — race conditions cause overselling
  3. Test with products at $0.01 and maximum price — boundary values reveal calculation bugs
  4. Always test tax calculation with multiple jurisdictions (US state tax, EU VAT, zero-tax items)
  5. Test email sending for every order state change — confirmation, shipped, delivered, refund

Key Takeaways

  1. E-commerce testing directly impacts revenue — bugs in cart and checkout mean lost sales
  2. Concurrency testing prevents overselling and pricing errors under high traffic
  3. The complete purchase flow from search to returns needs end-to-end coverage
  4. Multi-jurisdiction tax and shipping calculation testing requires a careful combinatorial approach