← Back to Webstore Course

Week 7: Testing Strategy in This Repo

Testing week focuses on confidence engineering. The student learns to write tests that protect real business behavior rather than implementation details.

Learning Objectives

  • Create route tests for success and failure scenarios.
  • Use mocks to isolate external dependencies.
  • Model edge cases tied to real business risk.
  • Use tests as documentation of expected behavior.

Detailed Topics

1. Test Scope Decisions

Teach when to use route-level tests, helper unit tests, and integration-style tests. Route tests often provide best value for internal APIs with business logic.

2. Mocking Strategy

Mock only external or unstable boundaries. Keep business logic paths as realistic as possible to avoid false confidence.

3. Regression-Focused Test Design

Include malformed inputs, missing auth, dependency timeout, and repeated request behavior when relevant.

Pair Session Plan (90 Minutes)

  1. Select one checkout/account/cart API route.
  2. Map critical behaviors and likely failure points.
  3. Implement at least five targeted test cases.
  4. Review test clarity and signal quality.

Independent Ticket

Add tests to one route that currently has weak coverage and include one scenario likely to catch a historical regression.

Mentor Checkpoint

  • Student can explain why each test exists.
  • Student avoids over-mocking core behavior paths.
  • Student writes test names as behavior statements.
← Previous: Week 6 Next: Week 8 →