Trang chủ
QA Learning Hub
Chương 10 · E-commerce Testing
Chương 10 Trung Cấp

E-commerce Testing

Đặc thù kiểm thử thương mại điện tử — từ catalog đến payment gateway với các edge case quan trọng.

🛍️ Product Catalog Testing
  • Search: Exact match, partial match, typo tolerance (phonetics), search with special characters, empty search, very long search string, search result count accuracy
  • Filter/Sort: Mỗi filter combination hoạt động đúng (price range + category + brand), AND logic giữa filters, clear individual filter vs clear all, sort by price/rating/new arrivals
  • Pagination: Page 1/2/last, điều hướng prev/next, URL có page parameter, khi filter thay đổi → về page 1
  • Product Detail: Image gallery, zoom, variant selection (size/color), stock status update, out-of-stock state, related products, reviews section
  • Stock Logic: Last item in stock warning, zero stock → out of stock message, stock reserve khi trong cart (và timeout)
🛒 Shopping Cart Edge Cases
  • Add to Cart: First item, add same item twice (quantity +1 hay 2 rows?), add from product list vs detail page, add from wishlist
  • Quantity: Min=1, max=available stock, type non-numeric, type negative, type 0, type decimal
  • Remove: Remove single item, remove all items → empty cart state, undo remove (nếu có)
  • Session Persistence: Cart sau khi close browser, cart sau session timeout, guest cart + login = cart merge hay replace?
  • Price Changes: Product price thay đổi trong khi đang trong cart → cart update automatically? Warning to user?
  • Out of Stock: Item hết hàng khi đang trong cart → warning hiển thị, không cho checkout
  • Cart Total: Subtotal accuracy, sau khi apply coupon, sau khi change quantity, currency formatting
💳 Checkout Flow
  1. Cart Review: All items correct, quantities editable, remove items, apply coupon code, total calculation
  2. Shipping Information: Address form validation (required fields), ZIP code format per country (US: 5 digits, UK: postcode format), address book (saved addresses), add new address
  3. Shipping Method: Available methods based on address, price calculation, estimated delivery date, free shipping threshold
  4. Payment: Multiple payment methods, secure form (HTTPS indicator), credit card validation, billing same as shipping address checkbox
  5. Order Review: Final summary correct (items, shipping, tax, discount, total), edit ability before confirm
  6. Order Confirmation: Confirmation page shows order number, confirmation email sent, inventory decremented, order appears in My Orders
⚠️ Multi-step Form Pitfalls
Test: browser back button at each step, refresh at each step, session timeout mid-checkout (data preserved?), click back to shopping to add more items then return to checkout, network failure at payment step.
💰 Payment Gateway Testing

Stripe Test Cards (phổ biến nhất):

Card NumberScenarioExpected
4242 4242 4242 4242Successful paymentPayment succeeds, order created
4000 0000 0000 0002Card declinedError: "Your card was declined"
4000 0000 0000 9995Insufficient fundsError: "Insufficient funds"
4000 0025 0000 31553D Secure authentication3DS modal appears, authenticate
4000 0000 0000 0069Expired cardError: "Card expired"
Any cardWrong CVV: 000Error: "CVC check failed"

Critical Payment Test Cases:

  • Double charge prevention: Double-click "Confirm Payment" button → chỉ 1 charge. Button disabled sau click đầu tiên?
  • Payment timeout: Network chậm, payment processing time out → user được refund, order không tạo
  • Partial refund: Refund 1 item trong order nhiều items → chỉ refund đúng số tiền, order status update đúng
  • Failed payment + retry: Payment fail → user có thể retry với card khác không mất order
  • Webhook delivery: Stripe webhook received → order status updated correctly even if user closed browser
  • Currency: USD, GBP, EUR — formatting, rounding, exchange rate display (nếu có)
🏷️ Promotions & Discount Testing
ScenarioTest CaseExpected
Valid codeApply SAVE20 (20% off)20% discount applied correctly to eligible items
Expired codeApply EXPIRED2024Error: "This code has expired"
Already usedApply ONETIME (single use, already redeemed)Error: "This code has already been used"
Wrong categoryApply SHOES10 to clothing itemsError: "This code doesn't apply to selected items"
Min order not metApply MIN100 (requires $100 order) on $50 cartError: "Minimum order $100 required"
Percentage vs Fixed10% off $50 vs $5 off $50$45 vs $45 (same here but different edge cases with max discount cap)
StackingApply 2 promo codesEither "cannot stack codes" error OR both apply correctly
Free shippingFREESHIP code on qualifying orderShipping cost = $0 in checkout
🧾 Tax & Shipping Calculation
  • US Sales Tax: Varies by state. Oregon = no sales tax. California = 7.25% base + local. Test với ZIP codes của các states khác nhau.
  • UK VAT: 20% on most goods. Some items exempt (food, children's clothing). Display: price ex-VAT vs inc-VAT.
  • EU VAT: Digital services: charge VAT of buyer's country. Physical goods: seller's country VAT until threshold.
  • Tax-inclusive display: Hiển thị $10 (inc. tax) vs $8.70 + $1.30 tax — consistent và đúng legal requirement.
  • Shipping tiers: Standard (5-7 days, $5.99), Expedited (2-3 days, $12.99), Overnight ($24.99). Free shipping threshold ($50+). Test chính xác với cart total sát threshold.
  • International shipping: Address in UK/EU → correct carrier options, duties/customs estimate, delivery time.
✏️ Bài Tập
📝 Bài Tập: Checkout Test Cases

Viết comprehensive test cases cho scenario: User có account, có saved credit card, muốn mua 2 items (1 regular price, 1 on sale), dùng promo code SAVE10 (10% off toàn đơn), ship tới California.

  1. List 15 test cases (positive + negative + edge) cho toàn bộ flow từ Cart đến Confirmation
  2. Xác định 3 test cases có risk cao nhất và giải thích tại sao
  3. Tính toán expected total: Items $45 + $30 = $75, discount 10%, CA tax 8.5%, standard shipping $5.99
  4. Viết bug title cho scenario: Double-click "Place Order" charges user twice