name: ‘step-04-session-03’ description: ‘Session 3: Architecture & Patterns - Fixtures, network patterns, framework setup (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-03-notes.md’ nextStepFile: ‘{skill-root}/steps-c/step-03-session-menu.md’ advancedElicitationTask: ‘{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml’
To teach TEA architecture patterns including fixture composition, network-first patterns, and step-file architecture in a 60-minute session.
{communication_language}CRITICAL: Follow this sequence exactly.
“🧪 Session 3: Architecture & Patterns (60 minutes)
Objective: Understand TEA patterns and architecture
What you’ll learn:
Let’s explore TEA architecture!”
Load {progressFile}, update session-03-architecture:
status: 'in-progress'started_date: {current_date}”### 🏗️ Fixture Architecture
The Problem: Tests have setup/teardown boilerplate everywhere.
TEA Solution: Composable fixtures
Fixture Composition Pattern:
// Base fixtures
const baseFixtures = {
page: async ({}, use) => {
/* ... */
},
};
// Composed fixtures
const authFixtures = {
authenticatedPage: async ({ page }, use) => {
await page.goto('/login');
await login(page);
await use(page);
},
};
// Merge and use
test.use(mergeTests(baseFixtures, authFixtures));
Benefits:
{Role-adapted example based on user role}
Documentation: https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/fixture-architecture/ Knowledge Fragment: fixture-architecture.md, fixtures-composition.md”
”### 🌐 Network-First Patterns
The Problem: Flaky tests due to network timing issues.
TEA Solution: Intercept and control network
Network-First Pattern:
// BEFORE the action, set up network interception
await page.route('/api/users', (route) => {
route.fulfill({ json: mockUsers });
});
// THEN trigger the action
await page.click('Load Users');
// Network is already mocked - no race condition
Why Network-First:
{Role-adapted example}
Documentation: https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/network-first-patterns/ Knowledge Fragment: network-first.md, intercept-network-call.md”
”### 🏭 Data Factories
The Problem: Hard-coded test data everywhere.
TEA Solution: Factory functions
Factory Pattern:
function createUser(overrides = {}) {
return {
id: faker.uuid(),
email: faker.email(),
role: 'user',
...overrides,
};
}
// Use in tests
const admin = createUser({ role: 'admin' });
const user = createUser(); // defaults
Benefits:
{Role-adapted example}
Knowledge Fragment: data-factories.md”
”### 📋 Step-File Architecture
This workflow uses step-file architecture!
Pattern:
Why:
You’re experiencing this right now: Each session is a step file!
Documentation: https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/step-file-architecture/“
”### ✅ Knowledge Check”
Q1: “What is the main benefit of fixture composition? A) Faster test execution B) DRY - define once, reuse everywhere C) Better error messages D) Automatic screenshot capture”
Correct: B
Q2: “Why is ‘network-first’ better than mocking after the action? A) It’s faster B) It prevents race conditions C) It uses less memory D) It’s easier to write”
Correct: B
Q3: “What pattern does this teaching workflow use? A) Page Object Model B) Behavior Driven Development C) Step-File Architecture D) Test Pyramid”
Correct: C
Calculate score, handle <70% retry option.
Create {sessionNotesFile} with:
Update session-03-architecture:
status: 'completed'completed_date: {current_date}score: {score}notes_artifactIncrement sessions_completed, update completion_percentage. Append ‘step-04-session-03’ to stepsCompleted.
“🎉 Session 3 Complete! Score: {score}/100 You understand TEA architecture patterns! Progress: {completion_percentage}%”
[A] Advanced Elicitation [P] Party Mode [C] Continue to Session Menu
Return to {nextStepFile}
Master Rule: Teach patterns, quiz, update, return to hub.