Testing strategy:

Unit tests (70%)

  • Test individual functions/components
  • Fast, isolated, deterministic
  • Mock dependencies
  • Example: Jest, Vitest

Integration tests (20%)

  • Test component interactions
  • Test API endpoints
  • Test database queries
  • Example: Supertest, Testing Library

E2E tests (10%)

  • Test user workflows
  • Test real browser behavior
  • Slow, flaky, expensive
  • Example: Playwright, Cypress, Nightwatch

The test pyramid:

    /\     E2E (few)
   /  \
  /    \   Integration (some)
 /______\
         Unit (many)

Rule of thumb: If you can test it at unit level, don't test it at E2E level.