ClaudetestingTesting
Testing Claude Rules
Claude rules for writing high-quality tests: test pyramid strategy, mocking principles, and CI integration.
CLAUDE.md
- Follow the testing pyramid: many unit tests, fewer integration tests, few E2E tests - Use dependency injection to make all code testable without mocking frameworks - Test through the public API of modules; avoid testing private implementation - Use realistic test data with factories; avoid magic strings and numbers - Write E2E tests for critical user journeys (signup, checkout, auth flows) - Use Playwright for E2E tests; run them against a staging environment in CI - Measure mutation score with Stryker to assess test quality beyond coverage - Make flaky tests a P1 bug; never commit tests that pass intermittently
How to use with Claude
Create a `CLAUDE.md` file in your project root. Claude Code reads this on startup and follows your conventions throughout the session.
#testing#claude#e2e#unit-tests#coding-rules
Related Rules
React Claude Rules
ClaudeReact
Claude rules for React: component design, state patterns, performance, and testing conventions in CLAUDE.md.
Architecture
react · claudeCopy Ready
Next.js Claude Rules
ClaudeNext.js
Claude rules for Next.js App Router: streaming, server actions, caching, and production deployment patterns.
Architecture
nextjs · claudeCopy Ready
Go Claude Rules
ClaudeGo
Claude rules for Go: project structure, error handling, testing, and idiomatic Go patterns.
Architecture
go · golangCopy Ready
Rust Claude Rules
ClaudeRust
Claude rules for Rust: zero-cost abstractions, async with Tokio, error types, and high-performance Rust patterns.
Performance
rust · tokioCopy Ready