chicago-tdd-pattern
掌握芝加哥 TDD(基于州的测试)。创建测试来验证与真实协作者的可观察行为。使用chicago-tdd-tools 1.4.0 AAA 模式。编写测试、验证实现正确性、提高测试质量或分析测试覆盖率时。涵盖:单元测试、集成测试、突变测试、断言分析。
📖 中文导读:掌握芝加哥 TDD(基于州的测试)。创建测试来验证与真实协作者的可观察行为。使用chicago-tdd-tools 1.4.0 AAA 模式。编写测试、验证实现正确性、提高测试质量或分析测试覆盖率时。涵盖:单元测试、集成测试、突变测试、断言分析。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
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