Good Test Principles (Khorikov's Theory)
This skill provides language-agnostic principles for writing high-value tests based on Vladimir Khorikov's "Unit Testing Principles, Practices, and Patterns".
When to Use This Skill
- •Writing or reviewing unit tests
- •Evaluating test quality
- •Designing testable architecture
- •Making decisions about test doubles (mocks/stubs)
Core Concept
The ultimate goal of unit testing is sustainable software growth, not just bug detection. Tests are assets that must provide more value than their maintenance cost.
Quick Reference
Four Pillars of Good Tests
- •Protection Against Regressions - Bug detection effectiveness
- •Resistance to Refactoring - Avoids false positives (MOST IMPORTANT)
- •Fast Feedback - Quick execution
- •Maintainability - Easy to understand and run
Test Style Hierarchy (Best → Worst)
- •Output-based - Verify return values only (pure functions)
- •State-based - Verify state changes after operations
- •Communication-based - Verify mock interactions (minimize use)
Classical Approach
- •Unit = Behavior unit (not class)
- •Isolate test cases from each other
- •Mock only shared dependencies
- •Use real instances for private dependencies
Resources
Read these in order for comprehensive understanding:
- •
resources/four-pillars.md- The Four Pillars in detail - •
resources/classical-approach.md- Classical vs London school - •
resources/test-styles.md- Output/State/Communication styles - •
resources/mock-vs-stub.md- CQS-based test double usage
Integration with Other Skills
- •clean-architecture: Functional Core, Imperative Shell for testability
- •code-review-guideline: Test quality review checklist
- •For language-specific implementation, see app-level skills (e.g., tdd-guideline in frontend)