name: ‘step-04-session-05’ description: ‘Session 5: ATDD & Automate - TDD red-green approach, generate tests (60 min)’
progressFile: ‘{test_artifacts}/teaching-progress/{user_name}-tea-progress.yaml’ sessionNotesTemplate: ‘../templates/session-notes-template.md’ sessionNotesFile: ‘{test_artifacts}/tea-academy/{user_name}/session-05-notes.md’ nextStepFile: ‘{skill-root}/steps-c/step-03-session-menu.md’ advancedElicitationTask: ‘{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml’
To teach ATDD (red-green TDD) and Automate workflows for test generation in a 60-minute session.
“🧪 Session 5: ATDD & Automate (60 minutes)
Objective: Generate tests with TDD red-green approach
What you’ll learn:
Let’s generate some tests!”
Load {progressFile} and update session-05-atdd-automate:
status: 'in-progress'started_date: {current_date} if not already setSave the updated progress file.
”### 🔴 ATDD: Acceptance-Driven Test Development
TDD Red Phase: Write failing tests FIRST
ATDD Workflow:
Why Failing Tests First:
{Role-adapted example}
Documentation: https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/how-to/workflows/run-atdd/“
”### 🤖 Automate: Expand Test Coverage
Purpose: Generate tests for existing features
Automate Workflow:
Difference from ATDD:
{Role-adapted example}
Documentation: https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/how-to/workflows/run-automate/“
”### 🔄 Component TDD Red-Green Loop
Pattern:
Example:
// RED: Test fails (function doesn't exist)
test('calculates total price', () => {
expect(calculateTotal([10, 20])).toBe(30);
});
// GREEN: Minimal implementation
function calculateTotal(prices) {
return prices.reduce((a, b) => a + b, 0);
}
// REFACTOR: Add validation, tests still green
{Role-adapted example}
Knowledge Fragment: component-tdd.md”
”### 🌐 API Testing Patterns
Pure API Testing (no browser):
Pattern:
test('GET /users returns user list', async ({ request }) => {
const response = await request.get('/api/users');
expect(response.ok()).toBeTruthy();
const users = await response.json();
expect(users).toHaveLength(10);
});
{Role-adapted example}
Knowledge Fragment: api-testing-patterns.md, api-request.md”
Q1: “What is the ‘red’ phase in TDD? A) Tests fail (code doesn’t exist yet) B) Tests pass C) Code is refactored D) Tests are deleted”
Correct: A
Q2: “What’s the difference between ATDD and Automate workflows? A) ATDD generates E2E, Automate generates API tests B) ATDD writes tests first (red phase), Automate tests existing code C) ATDD is faster than Automate D) They’re the same workflow”
Correct: B
Q3: “Why use pure API tests without a browser? A) They look prettier B) They’re easier to debug C) They’re faster and test business logic directly D) They’re required by TEA”
Correct: C
Calculate score, handle <70% retry.
Create {sessionNotesFile} with Session 5 content:
Update session-05-atdd-automate: completed, score, notes. Increment sessions_completed, update percentage. Append ‘step-04-session-05’ to stepsCompleted. Set next_recommended: ‘session-06-quality-trace’.
“🎉 Session 5 Complete! Score: {score}/100 You can now generate tests with ATDD and Automate! Progress: {completion_percentage}%”
[A] Advanced Elicitation [P] Party Mode [C] Continue to Session Menu
Return to {nextStepFile}.
✅ ATDD and Automate taught, TDD explained, quiz passed, notes generated, progress updated, returned to hub.