engineering
Test Plan Writing
Write risk-based test plans with coverage matrices, test level decisions, pass/fail criteria, and environment requirements — deciding what to test, at which level, and why.
testingtest-plancoveragequality-assurancetest-strategy
Works well with agents
Works well with skills
$ npx skills add The-AI-Directory-Company/(…) --skill test-plan-writingtest-plan-writing/
checkout-flow.md
Markdown
| 1 | # Test Plan: E-Commerce Checkout Flow |
| 2 | |
| 3 | ## 1. Scope |
| 4 | |
| 5 | **In scope**: Cart review, shipping address entry, payment processing (Stripe), order confirmation, and email receipt. Covers web (desktop + mobile viewport) and iOS app. |
| 6 | |
| 7 | **Out of scope**: |
| 8 | - Product browsing and cart management (unchanged, tested separately in CART-220) |
| 9 | - Loyalty points redemption (Phase 2, not launching until Q1) |
| 10 | - Guest checkout (separate ticket CHK-415) |
| 11 | |
| 12 | ## 2. Risk Analysis |
| 13 | |
| 14 | | Component | Likelihood | Impact | Risk Level | Testing Investment | |
| 15 | |-----------|-----------|--------|------------|-------------------| |
| 16 | | Payment processing (Stripe) | Medium | Critical | **High** | Extensive | |
| 17 | | Shipping cost calculation | Medium | High | **High** | Extensive | |
| 18 | | Promo code application | High | High | **High** | Extensive | |
| 19 | | Address validation (SmartyStreets) | Medium | Medium | **Medium** | Moderate | |
| 20 | | Order confirmation page | Low | Low | **Low** | Minimal | |
| 21 | | Email receipt (SendGrid) | Low | Medium | **Low** | Minimal | |
| 22 | |
| 23 | Notes: Payment and promo codes are high-risk because bugs directly cause revenue loss. Promo code likelihood is elevated due to new stacking logic with no existing test coverage. |
| 24 | |
| 25 | ## 3. Test Levels per Component |
| 26 | |
| 27 | | Component | Unit | Integration | E2E | Manual | Rationale | |
| 28 | |-----------|------|-------------|-----|--------|-----------| |
| 29 | | Promo code stacking logic | Yes | No | Yes | No | Pure calculation logic + complex user-facing edge cases | |
| 30 | | Shipping cost calculation | Yes | Yes | No | No | Logic is testable; integration verifies rate API contract | |
| 31 | | Stripe payment | No | Yes | Yes | No | Must verify real Stripe sandbox behavior | |
| 32 | | Address validation | No | Yes | No | No | Third-party API contract test only | |
| 33 | | Order confirmation | No | No | No | Yes | Visual review, low risk | |
| 34 | | Email receipt | No | Yes | No | Yes | Verify template renders; manual spot-check formatting | |
| 35 | |
| 36 | ## 4. Coverage Targets |
| 37 | |
| 38 | ``` |
| 39 | High-risk (payment, shipping, promo): 90%+ line coverage, 100% acceptance criteria |
| 40 | Medium-risk (address validation): 75%+ line coverage, happy path + known edge cases |
| 41 | Low-risk (confirmation, email): 50%+ line coverage, happy path only |
| 42 | ``` |
| 43 | |
| 44 | ## 5. Test Cases |
| 45 | |
| 46 | **P0 — Must pass before release:** |
| 47 | - [ ] Valid Visa charge succeeds and returns order confirmation with correct total |
| 48 | - [ ] Declined card shows user-facing error; no order or charge created |
| 49 | - [ ] Stripe timeout (> 5s) retries once, then shows "try again" with no duplicate charge |
| 50 | - [ ] Promo code applies correct discount; cart total, tax, and Stripe charge all match |
| 51 | - [ ] Shipping cost recalculates when address changes from domestic to international |
| 52 | |
| 53 | **P1 — Should pass, release-blocking if broken:** |
| 54 | - [ ] Double-click "Place Order" within 2s is idempotent (single charge, single order) |
| 55 | - [ ] Expired promo code returns clear error, does not apply partial discount |
| 56 | - [ ] Two valid promo codes stack correctly (percentage applied before fixed amount) |
| 57 | - [ ] Invalid address rejected by SmartyStreets shows inline validation message |
| 58 | |
| 59 | **P2 — Nice to verify, not release-blocking:** |
| 60 | - [ ] Order confirmation email arrives within 60s with correct line items |
| 61 | - [ ] Checkout accessible at mobile viewport (375px) with no horizontal scroll |
| 62 | - [ ] Browser back button from confirmation does not re-submit payment |
| 63 | |
| 64 | ## 6. Environment Requirements |
| 65 | |
| 66 | ``` |
| 67 | Unit tests: Local, no external deps, mock Stripe + SmartyStreets |
| 68 | Integration: CI, Stripe sandbox keys, SmartyStreets test key, test database |
| 69 | E2E: Staging, seeded catalog (10 products, 3 promo codes), Stripe sandbox |
| 70 | Manual: Staging with production-like data volume (1k orders) |
| 71 | ``` |
| 72 | |
| 73 | **Blocker**: Staging must have Stripe sandbox webhook configured before E2E tests run. Owner: @devops, due before test cycle starts. |
| 74 | |
| 75 | ## 7. Pass/Fail Criteria |
| 76 | |
| 77 | ``` |
| 78 | Release is GO when: |
| 79 | - All P0 test cases pass |
| 80 | - All P1 cases pass OR have documented workarounds approved by eng lead |
| 81 | - No open P0/P1 bugs |
| 82 | - Coverage targets met per risk level |
| 83 | |
| 84 | Release is NO-GO when: |
| 85 | - Any P0 test case fails |
| 86 | - More than 2 P1 cases fail without approved workarounds |
| 87 | - A payment-related bug is found outside the test plan scope |
| 88 | ``` |
| 89 | |
| 90 | ## 8. Schedule |
| 91 | |
| 92 | | Day | Activity | |
| 93 | |-----|----------| |
| 94 | | Mon | Unit + integration tests written and passing in CI | |
| 95 | | Tue | E2E tests written; staging environment verified | |
| 96 | | Wed | Full test suite run; bug triage | |
| 97 | | Thu | Bug fixes + re-run failing tests | |
| 98 | | Fri | Manual QA on staging; GO/NO-GO decision by 3pm | |
| 99 |