Execute tests following TDD cycle: RED (verify test fails) → GREEN (implement to pass) → REFACTOR. Interprets tests.json and performs steps using available tools (browser MCP, API, CLI, etc.). WHEN TO USE: - Starting implementation of a ticket with TDD: yes - After writing test spec (3-spec.md) and tests.json - When user says "run tests", "test this", "TDD cycle" - After fixing a failing test REQUIRES: - Ticket with 3-spec.md - tests.json in .pmc/docs/tests/tickets/T0000N/
Execute tests following TDD methodology with trajectory recording.
ALWAYS run /pmc:kb first to understand test format and TDD workflow.
1. RED (required for TDD tickets)
└── Run test BEFORE implementation
└── Verify it fails (expected behavior)
└── Record red_verified timestamp
2. GREEN
└── Implement minimal code to pass
└── Run test again
└── Record trajectory
3. REFACTOR
└── Clean up code (keep tests green)
└── Run tests to confirm still passing
└── Record refactor notes in trajectory
Read: .pmc/docs/tests/tickets/T0000N/tests.json
If no tests.json exists:
Format: See kb/references/test-formats.md (config and setup sections)
Check config section for app_url, db settings. Execute setup array before tests.
Purpose: Confirm test fails because feature doesn't exist yet.
[RED] 2024-01-15T09:00:00 - Verified test fails: {reason}
red_verified timestamp in tests.json4-progress.md with RED statusIf test PASSES in RED phase:
[GREEN] 2024-01-15T10:30:00 - Implementation started
do: browser:navigate:/login → OK
verify: browser:element:#login-form exists → PASS
"status": "passed" or "status": "failed"4-progress.md with GREEN status[REFACTOR] 2024-01-15T11:00:00 - Extracted validation logic
| Action | Tool Call |
|---|---|
browser:navigate:{path} | mcp__chrome-devtools__navigate_page |
browser:click:{selector} | mcp__chrome-devtools__click |
browser:fill:{selector}={value} | mcp__chrome-devtools__fill |
browser:wait:{ms} | Wait or mcp__chrome-devtools__wait_for |
| Action | Command |
|---|---|
api:GET:{path} | curl -s {app_url}{path} |
api:POST:{path}:{body} | curl -s -X POST -d '{body}' {app_url}{path} |
| Action | Command |
|---|---|
cli:{command} | Bash: {command} |
script:{path} | Bash: uv run python {path} or appropriate runner |
| Action | Implementation |
|---|---|
db:{SQL} | Execute via CLI or API depending on setup |
Execute each item in verify array:
| Pattern | How to Check |
|---|---|
browser:url contains {text} | mcp__chrome-devtools__take_snapshot → check URL |
browser:element:{sel} exists | mcp__chrome-devtools__take_snapshot → find element |
browser:element:{sel} text={v} | Snapshot → check text content |
| Pattern | How |
|---|---|
screenshot:{name} | mcp__chrome-devtools__take_screenshot → save to screenshots/ |
| Pattern | How |
|---|---|
exit:0 | Check command exit code |
output contains {text} | Check stdout |
| Pattern | How |
|---|---|
status:{code} | Check HTTP status |
body.{field} == {value} | Parse JSON response |
Critical: Every action and result must be recorded.
Format: See kb/references/test-formats.md (trajectory section)
Quick reference: