-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Strategy
OpenClaw edited this page Feb 15, 2026
·
1 revision
Every feature must ship with tests. No exceptions.
-
All utility functions in
src/lib/ - All server actions — mock DB, test business logic
- All API routes — test request/response
- DB schema validation — ensure constraints work
- Coverage target: 100% lines, branches, functions
- Every user flow — login, create project, submit proposal, vote, comment
- Responsive testing — mobile + desktop viewports
- Dark mode — visual consistency
- Error states — invalid input, network errors, auth failures
- Accessibility — axe-core integration
┌──────────────┐ writes tests ┌──────────────┐
│ Codex CLI │ ──────────────────→ │ Test Suite │
└──────────────┘ └──────┬───────┘
│
must pass
│
┌──────────────┐ writes code ┌──────▼───────┐
│ Claude Code │ ──────────────────→ │ Codebase │
└──────────────┘ └──────────────┘
- Codex writes tests first (TDD style)
- Claude Code writes implementation to pass tests
- Neither agent sees the other's "strategy"
- This catches assumptions and blind spots
# Unit tests
npm run test # single run
npm run test:watch # watch mode
# E2E tests (requires Docker running)
npm run test:e2e # headless
npx playwright test --ui # interactive
# Coverage report
npx vitest run --coverage- GitHub Actions on PR
- Must pass all tests before merge
- Coverage report posted as PR comment
- Playwright screenshots on failure
- Unit:
tests/unit/<module>.test.ts - E2E:
tests/e2e/<feature>.spec.ts - Fixtures:
tests/fixtures/ - Test utils:
tests/helpers/
- SQLite in Docker — tests run against Docker container, not local
- Email testing — use mock SMTP or test accounts
- AI responses — mock LLM calls, test prompt construction
- Real-time updates — test WebSocket/SSE connections