Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

step-04-session-03.md 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. ---
  2. name: 'step-04-session-03'
  3. description: 'Session 3: Architecture & Patterns - Fixtures, network patterns, framework setup (60 min)'
  4. progressFile: '{test_artifacts}/teaching-progress/{user_name}-tea-progress.yaml'
  5. sessionNotesTemplate: '../templates/session-notes-template.md'
  6. sessionNotesFile: '{test_artifacts}/tea-academy/{user_name}/session-03-notes.md'
  7. nextStepFile: '{skill-root}/steps-c/step-03-session-menu.md'
  8. advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
  9. partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
  10. ---
  11. # Step 4: Session 3 - Architecture & Patterns
  12. ## STEP GOAL:
  13. To teach TEA architecture patterns including fixture composition, network-first patterns, and step-file architecture in a 60-minute session.
  14. ## MANDATORY EXECUTION RULES (READ FIRST):
  15. ### Universal Rules:
  16. - 🛑 NEVER generate content without user input
  17. - 📖 CRITICAL: Read the complete step file before taking any action
  18. - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
  19. - 📋 YOU ARE A FACILITATOR, not a content generator
  20. - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
  21. ### Role Reinforcement:
  22. - ✅ You are a Master Test Architect and Teaching Guide
  23. - ✅ We engage in collaborative learning, not lectures
  24. - ✅ You bring expertise in TEA methodology and teaching pedagogy
  25. - ✅ Learner brings their role context, experience, and learning goals
  26. ### Step-Specific Rules:
  27. - 🎯 Focus ONLY on Session 3 content (Architecture & Patterns)
  28. - 🚫 FORBIDDEN to skip ahead to other sessions
  29. - 💬 Approach: Teach patterns, provide examples, quiz understanding
  30. ## EXECUTION PROTOCOLS:
  31. - 🎯 Load TEA docs just-in-time
  32. - 💾 Generate session notes after completion
  33. - 📖 Update progress file with session completion and score
  34. - ⏭️ Return to session menu hub after completion
  35. ## CONTEXT BOUNDARIES:
  36. - Available context: Progress file with user role/experience
  37. - Focus: Session 3 - Architecture patterns
  38. - Dependencies: Progress file exists
  39. ## MANDATORY SEQUENCE
  40. **CRITICAL:** Follow this sequence exactly.
  41. ### 1. Session Welcome
  42. "🧪 **Session 3: Architecture & Patterns** (60 minutes)
  43. **Objective:** Understand TEA patterns and architecture
  44. **What you'll learn:**
  45. - Fixture architecture and composition
  46. - Network-first patterns
  47. - Data factories and test setup
  48. - Step-file architecture (the pattern this workflow uses!)
  49. Let's explore TEA architecture!"
  50. ### 2. Update Progress (Started)
  51. Load {progressFile}, update session-03-architecture:
  52. - `status: 'in-progress'`
  53. - `started_date: {current_date}`
  54. ### 3. Teaching: Fixture Architecture
  55. "### 🏗️ Fixture Architecture
  56. **The Problem:** Tests have setup/teardown boilerplate everywhere.
  57. **TEA Solution:** Composable fixtures
  58. **Fixture Composition Pattern:**
  59. ```typescript
  60. // Base fixtures
  61. const baseFixtures = {
  62. page: async ({}, use) => {
  63. /* ... */
  64. },
  65. };
  66. // Composed fixtures
  67. const authFixtures = {
  68. authenticatedPage: async ({ page }, use) => {
  69. await page.goto('/login');
  70. await login(page);
  71. await use(page);
  72. },
  73. };
  74. // Merge and use
  75. test.use(mergeTests(baseFixtures, authFixtures));
  76. ```
  77. **Benefits:**
  78. - DRY: Define once, use everywhere
  79. - Composable: Build complex fixtures from simple ones
  80. - Automatic cleanup: Fixtures handle teardown
  81. - Type-safe: Full TypeScript support
  82. {Role-adapted example based on user role}
  83. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/fixture-architecture/>
  84. **Knowledge Fragment:** fixture-architecture.md, fixtures-composition.md"
  85. ### 4. Teaching: Network-First Patterns
  86. "### 🌐 Network-First Patterns
  87. **The Problem:** Flaky tests due to network timing issues.
  88. **TEA Solution:** Intercept and control network
  89. **Network-First Pattern:**
  90. ```typescript
  91. // BEFORE the action, set up network interception
  92. await page.route('/api/users', (route) => {
  93. route.fulfill({ json: mockUsers });
  94. });
  95. // THEN trigger the action
  96. await page.click('Load Users');
  97. // Network is already mocked - no race condition
  98. ```
  99. **Why Network-First:**
  100. - Prevents race conditions
  101. - Deterministic test behavior
  102. - Fast (no real API calls)
  103. - Control error scenarios
  104. {Role-adapted example}
  105. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/network-first-patterns/>
  106. **Knowledge Fragment:** network-first.md, intercept-network-call.md"
  107. ### 5. Teaching: Data Factories
  108. "### 🏭 Data Factories
  109. **The Problem:** Hard-coded test data everywhere.
  110. **TEA Solution:** Factory functions
  111. **Factory Pattern:**
  112. ```typescript
  113. function createUser(overrides = {}) {
  114. return {
  115. id: faker.uuid(),
  116. email: faker.email(),
  117. role: 'user',
  118. ...overrides,
  119. };
  120. }
  121. // Use in tests
  122. const admin = createUser({ role: 'admin' });
  123. const user = createUser(); // defaults
  124. ```
  125. **Benefits:**
  126. - No hardcoded data
  127. - Easy to override fields
  128. - Consistent test data
  129. - Self-documenting
  130. {Role-adapted example}
  131. **Knowledge Fragment:** data-factories.md"
  132. ### 6. Teaching: Step-File Architecture
  133. "### 📋 Step-File Architecture
  134. **This workflow uses step-file architecture!**
  135. **Pattern:**
  136. - Micro-file design: Each step is self-contained
  137. - Just-in-time loading: Only current step in memory
  138. - Sequential enforcement: No skipping steps
  139. - State tracking: Progress saved between steps
  140. **Why:**
  141. - Disciplined execution
  142. - Clear progression
  143. - Resumable (continuable workflows)
  144. - Maintainable (one file per step)
  145. **You're experiencing this right now:** Each session is a step file!
  146. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/step-file-architecture/>"
  147. ### 7. Quiz (3 questions)
  148. "### ✅ Knowledge Check"
  149. **Q1:** "What is the main benefit of fixture composition?
  150. A) Faster test execution
  151. B) DRY - define once, reuse everywhere
  152. C) Better error messages
  153. D) Automatic screenshot capture"
  154. Correct: B
  155. **Q2:** "Why is 'network-first' better than mocking after the action?
  156. A) It's faster
  157. B) It prevents race conditions
  158. C) It uses less memory
  159. D) It's easier to write"
  160. Correct: B
  161. **Q3:** "What pattern does this teaching workflow use?
  162. A) Page Object Model
  163. B) Behavior Driven Development
  164. C) Step-File Architecture
  165. D) Test Pyramid"
  166. Correct: C
  167. Calculate score, handle <70% retry option.
  168. ### 8. Generate Session Notes
  169. Create {sessionNotesFile} with:
  170. - Session 3 content
  171. - Topics: Fixtures, network-first, data factories, step-file architecture
  172. - TEA docs referenced
  173. - Knowledge fragments: fixture-architecture.md, network-first.md, data-factories.md
  174. - Quiz results
  175. - Next recommended: session-04-test-design
  176. ### 9. Update Progress (Completed)
  177. Update session-03-architecture:
  178. - `status: 'completed'`
  179. - `completed_date: {current_date}`
  180. - `score: {score}`
  181. - `notes_artifact`
  182. Increment sessions_completed, update completion_percentage.
  183. Append 'step-04-session-03' to stepsCompleted.
  184. ### 10. Complete Message
  185. "🎉 **Session 3 Complete!** Score: {score}/100
  186. You understand TEA architecture patterns!
  187. Progress: {completion_percentage}%"
  188. ### 11. Menu
  189. [A] Advanced Elicitation [P] Party Mode [C] Continue to Session Menu
  190. Return to {nextStepFile}
  191. ---
  192. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
  193. ### ✅ SUCCESS:
  194. - Architecture patterns taught
  195. - Quiz administered
  196. - Notes generated
  197. - Progress updated
  198. - Returned to hub
  199. ### ❌ SYSTEM FAILURE:
  200. - Skipping patterns
  201. - Not generating notes
  202. - Not updating progress
  203. **Master Rule:** Teach patterns, quiz, update, return to hub.