Webapp Testing

Use when: test a web app across unit, integration, and end-to-end layers with the right balance.

kimtth 805b4ee 1.1 KB Updated

File contents

Goal: cover behavior at the cheapest layer that proves it.

Use for:

  • adding tests to a web app or feature
  • deciding what to unit test vs. integration vs. e2e
  • replacing brittle tests that break on refactors

Workflow:

  1. Identify the behavior and its user-visible contract.
  2. Choose the lowest layer that can verify it honestly.
  3. Unit test pure logic; integration test wiring; e2e the critical paths.
  4. Set up real dependencies where feasible; mock only true boundaries.
  5. Make tests deterministic: control time, network, and data.
  6. Run, confirm meaningful failure, then keep green.

Layer guidance:

  • unit: pure functions, reducers, validation
  • integration: components with real children, API handlers with a real db
  • e2e: signup, checkout, and other revenue-critical flows

Rules:

  • test behavior, not implementation detail
  • do not mock what you are trying to verify
  • keep e2e few and high-value; they are slow and flaky-prone
  • a test that never fails has no value

kimtth/agent-skill-100-lines-or-less/tree/main/skills/webapp-testing commit 805b4ee9c0

Frequently asked questions

npx skillmds@latest add kimtth/webapp-testing