Test-driven development methodology with four test types - unit, integration, property, and e2e. Use when writing tests, planning test strategy, implementing features test-first, or verifying test coverage. Triggers when tests are mentioned, test files are being created, or test-first approach is needed.
View on GitHubrand/disciplined-process-plugin
disciplined-process
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/rand/disciplined-process-plugin/blob/main/disciplined-process-plugin/skills/tdd-methodology/SKILL.md -a claude-code --skill tdd-methodologyInstallation paths:
.claude/skills/tdd-methodology/# Test-Driven Development Methodology
Tests verify specifications are met. Write tests BEFORE implementation. Tests reference spec paragraph IDs for traceability.
## The TDD Cycle
```
┌──────────────────┐
│ 1. RED │ Write a failing test for spec requirement
├──────────────────┤
│ 2. GREEN │ Write minimal code to pass
├──────────────────┤
│ 3. REFACTOR │ Improve code, keep tests green
└──────────────────┘
```
## Four Test Types
### 1. Unit Tests
**Purpose**: Test individual functions/methods in isolation
**Location**: `tests/unit/`
**Characteristics**:
- Fast (ms per test)
- No I/O, no network, no filesystem
- Mock external dependencies
- One assertion focus per test
**Pattern**:
```
test_<function>_<scenario>_<expected>
```
**Example** (Rust):
```rust
#[test]
// @trace SPEC-03.07
fn test_validate_length_exceeds_max_returns_error() {
let input = "x".repeat(1025);
assert!(validate_length(&input).is_err());
}
```
**Example** (TypeScript):
```typescript
describe('validateLength', () => {
// @trace SPEC-03.07
it('returns error when input exceeds max length', () => {
const input = 'x'.repeat(1025);
expect(() => validateLength(input)).toThrow();
});
});
```
**Example** (Python):
```python
def test_validate_length_exceeds_max_returns_error():
"""@trace SPEC-03.07"""
input_str = 'x' * 1025
with pytest.raises(ValidationError):
validate_length(input_str)
```
### 2. Integration Tests
**Purpose**: Test component interactions, real dependencies
**Location**: `tests/integration/`
**Characteristics**:
- Slower (seconds per test)
- Real database, real filesystem, test containers
- Test boundaries between modules
- Setup/teardown for external state
**Pattern**:
```
test_<component>_<integration>_<scenario>
```
**Example** (Rust):
```rust
#[tokio::test]
// @trace SPEC-05.12
async fn test_auth_service_validates_against_database() {
let db = TestDb::new().await;
let auth = Aut