name: 'step-04c-aggregate' description: 'Aggregate subprocess outputs and complete ATDD test infrastructure' outputFile: '{test_artifacts}/atdd-checklist-{story_id}.md'
Read outputs from parallel subprocesses (API + E2E failing test generation), aggregate results, verify TDD red phase compliance, and create supporting infrastructure.
{communication_language}CRITICAL: Follow this sequence exactly. Do not skip, reorder, or improvise.
Read API test subprocess output:
const apiTestsPath = '/tmp/tea-atdd-api-tests-{{timestamp}}.json';
const apiTestsOutput = JSON.parse(fs.readFileSync(apiTestsPath, 'utf8'));
Read E2E test subprocess output:
const e2eTestsPath = '/tmp/tea-atdd-e2e-tests-{{timestamp}}.json';
const e2eTestsOutput = JSON.parse(fs.readFileSync(e2eTestsPath, 'utf8'));
Verify both subprocesses succeeded:
apiTestsOutput.success === truee2eTestsOutput.success === trueCRITICAL TDD Validation:
Check API tests:
apiTestsOutput.tests.forEach((test) => {
// Verify test.skip() is present
if (!test.content.includes('test.skip(')) {
throw new Error(`ATDD ERROR: ${test.file} missing test.skip() - tests MUST be skipped in red phase!`);
}
// Verify not placeholder assertions
if (test.content.includes('expect(true).toBe(true)')) {
throw new Error(`ATDD ERROR: ${test.file} has placeholder assertions - must assert EXPECTED behavior!`);
}
// Verify expected_to_fail flag
if (!test.expected_to_fail) {
throw new Error(`ATDD ERROR: ${test.file} not marked as expected_to_fail!`);
}
});
Check E2E tests:
e2eTestsOutput.tests.forEach((test) => {
// Same validation as API tests
if (!test.content.includes('test.skip(')) {
throw new Error(`ATDD ERROR: ${test.file} missing test.skip() - tests MUST be skipped in red phase!`);
}
if (test.content.includes('expect(true).toBe(true)')) {
throw new Error(`ATDD ERROR: ${test.file} has placeholder assertions!`);
}
if (!test.expected_to_fail) {
throw new Error(`ATDD ERROR: ${test.file} not marked as expected_to_fail!`);
}
});
If validation passes:
✅ TDD Red Phase Validation: PASS
- All tests use test.skip()
- All tests assert expected behavior (not placeholders)
- All tests marked as expected_to_fail
Write API test files:
apiTestsOutput.tests.forEach((test) => {
fs.writeFileSync(test.file, test.content, 'utf8');
console.log(`✅ Created (RED): ${test.file}`);
});
Write E2E test files:
e2eTestsOutput.tests.forEach((test) => {
fs.writeFileSync(test.file, test.content, 'utf8');
console.log(`✅ Created (RED): ${test.file}`);
});
Collect all fixture needs from both subprocesses:
const allFixtureNeeds = [...apiTestsOutput.fixture_needs, ...e2eTestsOutput.fixture_needs];
// Remove duplicates
const uniqueFixtures = [...new Set(allFixtureNeeds)];
Create fixtures needed by ATDD tests: (Similar to automate workflow, but may be simpler for ATDD since feature not implemented)
Minimal fixtures for TDD red phase:
// tests/fixtures/test-data.ts
export const testUserData = {
email: 'test@example.com',
password: 'SecurePass123!',
};
Note: More complete fixtures will be needed when moving to green phase.
Create ATDD checklist document:
# ATDD Checklist: [Story Name]
## TDD Red Phase (Current)
✅ Failing tests generated
- API Tests: {api_test_count} tests (all skipped)
- E2E Tests: {e2e_test_count} tests (all skipped)
## Acceptance Criteria Coverage
{list all acceptance criteria with test coverage}
## Next Steps (TDD Green Phase)
After implementing the feature:
1. Remove `test.skip()` from all test files
2. Run tests: `npm test`
3. Verify tests PASS (green phase)
4. If any tests fail:
- Either fix implementation (feature bug)
- Or fix test (test bug)
5. Commit passing tests
## Implementation Guidance
Feature endpoints to implement:
{list endpoints from API tests}
UI components to implement:
{list UI flows from E2E tests}
Save checklist:
fs.writeFileSync(`{test_artifacts}/atdd-checklist-{story-id}.md`, checklistContent, 'utf8');
Aggregate test counts:
const summary = {
tdd_phase: 'RED',
total_tests: apiTestsOutput.test_count + e2eTestsOutput.test_count,
api_tests: apiTestsOutput.test_count,
e2e_tests: e2eTestsOutput.test_count,
all_tests_skipped: true,
expected_to_fail: true,
fixtures_created: uniqueFixtures.length,
acceptance_criteria_covered: [
...apiTestsOutput.tests.flatMap((t) => t.acceptance_criteria_covered),
...e2eTestsOutput.tests.flatMap((t) => t.acceptance_criteria_covered),
],
knowledge_fragments_used: [...apiTestsOutput.knowledge_fragments_used, ...e2eTestsOutput.knowledge_fragments_used],
subprocess_execution: 'PARALLEL (API + E2E)',
performance_gain: '~50% faster than sequential',
};
Store summary for Step 5:
fs.writeFileSync('/tmp/tea-atdd-summary-{{timestamp}}.json', JSON.stringify(summary, null, 2), 'utf8');
Display to user:
✅ ATDD Test Generation Complete (TDD RED PHASE)
🔴 TDD Red Phase: Failing Tests Generated
📊 Summary:
- Total Tests: {total_tests} (all with test.skip())
- API Tests: {api_tests} (RED)
- E2E Tests: {e2e_tests} (RED)
- Fixtures Created: {fixtures_created}
- All tests will FAIL until feature implemented
✅ Acceptance Criteria Coverage:
{list all covered criteria}
🚀 Performance: Parallel execution ~50% faster than sequential
📂 Generated Files:
- tests/api/[feature].spec.ts (with test.skip())
- tests/e2e/[feature].spec.ts (with test.skip())
- tests/fixtures/test-data.ts
- {test_artifacts}/atdd-checklist-{story-id}.md
📝 Next Steps:
1. Implement the feature
2. Remove test.skip() from tests
3. Run tests → verify PASS (green phase)
4. Commit passing tests
✅ Ready for validation (Step 5 - verify tests fail as expected)
Proceed to Step 5 when:
Save this step's accumulated work to {outputFile}.
If {outputFile} does not exist (first save), create it with YAML frontmatter:
---
stepsCompleted: ['step-04c-aggregate']
lastStep: 'step-04c-aggregate'
lastSaved: '{date}'
---
Then write this step's output below the frontmatter.
{outputFile} already exists, update:
'step-04c-aggregate' to stepsCompleted array (only if not already present)lastStep: 'step-04c-aggregate'lastSaved: '{date}'Load next step: {nextStepFile}
Master Rule: TDD RED PHASE requires ALL tests to use test.skip() and assert expected behavior.