test
Installation
SKILL.md
Test
Pick the Right Layer First
Writing tests at the wrong layer is the most common testing mistake. A unit test that mocks everything doesn't catch integration bugs; an E2E test for a pure function is slow and fragile.
| Layer | What it tests | Speed | When to use |
|---|---|---|---|
| Unit | Pure functions, isolated logic | ~ms | Business logic, utilities, transformations |
| Integration | Service boundaries, DB queries, API contracts | ~seconds | Repository layer, HTTP handlers, queue consumers |
| E2E | User flows in a real browser | ~minutes | Critical paths only (checkout, auth, onboarding) |
The pyramid holds: many units, fewer integrations, minimal E2E.
Detect the Framework
Check before choosing: