chicago-tdd-pattern
Master Chicago TDD (state-based testing). Create tests that verify observable behavior with real collaborators. Use chicago-tdd-tools 1.4.0 AAA pattern. When writing tests, verifying implementation correctness, improving test quality, or analyzing test coverage. Covers: unit tests, integration tests, mutation testing, assertion analysis.
When & Why to Use This Skill
This Claude skill specializes in the Chicago TDD (Test-Driven Development) methodology, emphasizing state-based testing and observable behavior verification. By leveraging the AAA (Arrange-Act-Assert) pattern and utilizing real collaborators instead of mocks, it helps developers build robust, deterministic, and maintainable test suites. It is designed to improve software quality through precise unit testing, integration testing, and comprehensive assertion analysis.
Use Cases
- State-Based Unit Testing: Developing unit tests that verify public API responses and internal state changes using real objects to ensure implementation correctness.
- Integration Testing: Validating complex interactions between multiple system components without the overhead of fragile mock objects.
- Test Suite Refactoring: Converting legacy or flaky tests into the structured AAA pattern to improve readability and execution reliability.
- Quality Assurance & Coverage: Performing mutation testing and assertion analysis to identify gaps in test logic and improve overall code coverage.
| name | chicago-tdd-pattern |
|---|---|
| description | "Master Chicago TDD (state-based testing). Verify observable behavior with real collaborators using AAA pattern." |
| allowed_tools | "Read, Write, Bash(cargo make test:*)" |
Chicago TDD Pattern
Core Philosophy
Chicago TDD = State-based testing with real collaborators
Verify observable behavior changes (return values, state mutations, side effects), NOT internal implementation or mocks.
AAA Pattern
#[test]
fn test_feature() {
// ARRANGE: Set up real objects (no mocks)
let manager = Manager::new(temp_dir.path());
// ACT: Call the public API
manager.execute("command").unwrap();
// ASSERT: Verify observable state
assert_eq!(manager.status(), Status::Complete);
}
Key Principles
- Use real objects (not mocks)
- Test observable behavior
- Avoid testing internal implementation
- One assertion = one test (focused)
- No flaky tests (deterministic)
Reference
See CLAUDE.md sections:
- Development Workflow (Chicago TDD)
- Stack: chicago-tdd-tools 1.4.0
- Agents: test-engineer