You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. ---
  2. name: 'step-04-session-02'
  3. description: 'Session 2: Core Concepts - Risk-based testing, DoD, testing philosophy (45 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-02-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 2 - Core Concepts
  12. ## STEP GOAL:
  13. To teach testing fundamentals including risk-based testing, TEA quality standards (Definition of Done), and testing as engineering philosophy in a 45-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. - ✅ Together we build their testing knowledge progressively
  27. ### Step-Specific Rules:
  28. - 🎯 Focus ONLY on Session 2 content (Core Concepts)
  29. - 🚫 FORBIDDEN to skip ahead to other sessions
  30. - 💬 Approach: Teach fundamentals, provide examples, quiz understanding
  31. - 🚪 Teaching is mostly autonomous, quiz is collaborative
  32. - 📚 Reference TEA docs and knowledge fragments
  33. ## EXECUTION PROTOCOLS:
  34. - 🎯 Load TEA docs just-in-time
  35. - 💾 Generate session notes after completion
  36. - 📖 Update progress file with session completion and score
  37. - 🚫 FORBIDDEN to skip quiz - validates understanding
  38. - ⏭️ Always return to session menu hub after completion
  39. ## CONTEXT BOUNDARIES:
  40. - Available context: Progress file with user role/experience
  41. - Focus: Session 2 - Testing fundamentals and TEA principles
  42. - Limits: Only Session 2 content
  43. - Dependencies: Progress file exists with assessment data
  44. ## MANDATORY SEQUENCE
  45. **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
  46. ### 1. Session Welcome
  47. Display:
  48. "🧪 **Session 2: Core Concepts** (45 minutes)
  49. **Objective:** Understand WHY behind TEA principles
  50. **What you'll learn:**
  51. - Testing as Engineering philosophy
  52. - Risk-based testing with P0-P3 matrix
  53. - TEA Definition of Done (quality standards)
  54. - Probability × Impact risk scoring
  55. Let's dive into the fundamentals!"
  56. ### 2. Update Progress File (Session Started)
  57. Load {progressFile} and update session-02-concepts:
  58. - Set `status: 'in-progress'`
  59. - Set `started_date: {current_date}`
  60. Save the updated progress file.
  61. ### 3. Teaching: Testing as Engineering
  62. Present this content:
  63. "### 🏗️ Testing as Engineering
  64. **Core Philosophy:** Testing is not an afterthought - it's engineering.
  65. **What this means:**
  66. - Tests are **designed** before they're written (like architecture before coding)
  67. - Tests have **quality standards** (not just "does it run?")
  68. - Tests are **maintained** like production code
  69. - Testing decisions are **risk-based** (prioritize what matters)
  70. {If role == QA:}
  71. **For QA Engineers:** You're not just finding bugs - you're engineering test systems that scale. Design before write, maintain like production code.
  72. {If role == Dev:}
  73. **For Developers:** Think of tests like you think of production code. Design patterns, refactoring, DRY principles - they all apply to tests.
  74. {If role == Lead:}
  75. **For Tech Leads:** Testing as engineering means architecture decisions: fixture patterns, data strategies, CI orchestration. Not just "write more tests."
  76. {If role == VP:}
  77. **For VPs:** Testing is an engineering discipline requiring investment in tooling, architecture, and knowledge. Not a checklist item.
  78. **Key Principle:** If you wouldn't accept sloppy production code, don't accept sloppy test code.
  79. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/testing-as-engineering/>"
  80. ### 4. Teaching: Risk-Based Testing
  81. Present this content:
  82. "### ⚖️ Risk-Based Testing: The P0-P3 Matrix
  83. **Problem:** You can't test everything. How do you prioritize?
  84. **Solution:** Risk = Probability × Impact
  85. **The P0-P3 Matrix:**
  86. **P0 - Critical (Must Test)**
  87. - Login/Authentication
  88. - Payment processing
  89. - Data loss scenarios
  90. - Security vulnerabilities
  91. - **Impact:** Business fails if broken
  92. - **Probability:** High usage, high complexity
  93. **P1 - High (Should Test)**
  94. - Core user workflows
  95. - Key features
  96. - Data integrity
  97. - **Impact:** Major user pain
  98. - **Probability:** Frequent usage
  99. **P2 - Medium (Nice to Test)**
  100. - Secondary features
  101. - Edge cases with workarounds
  102. - **Impact:** Inconvenience
  103. - **Probability:** Moderate usage
  104. **P3 - Low (Optional)**
  105. - Tooltips, help text
  106. - Nice-to-have features
  107. - Aesthetic issues
  108. - **Impact:** Minimal
  109. - **Probability:** Low usage
  110. {If role == QA:}
  111. **For QA Engineers:** Use P0-P3 to defend test coverage decisions. "We have 100% P0 coverage, 80% P1" is better than "we have 50% coverage overall."
  112. {If role == Dev:}
  113. **For Developers:** When writing tests, ask "Is this P0 login or P3 tooltip?" Focus your time accordingly.
  114. {If role == Lead:}
  115. **For Tech Leads:** P0-P3 helps allocate test automation budget. Mandate P0/P1 automation, P2/P3 is cost-benefit analysis.
  116. {If role == VP:}
  117. **For VPs:** Risk-based testing aligns engineering effort with business impact. Metrics that matter: P0 coverage, not lines of code.
  118. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/risk-based-testing/>
  119. **Knowledge Fragment:** probability-impact.md defines scoring criteria"
  120. ### 5. Teaching: Definition of Done (Quality Standards)
  121. Present this content:
  122. "### ✅ TEA Definition of Done: Quality Standards
  123. **The Problem:** "The tests pass" isn't enough. What about quality?
  124. **TEA Definition of Done ensures:**
  125. **1. No Flaky Tests**
  126. - Tests pass/fail deterministically
  127. - No "run it again, it'll work" tests
  128. - Use explicit waits, not hard sleeps
  129. - Handle async properly
  130. **2. No Hard Waits/Sleeps**
  131. - Use `waitFor` conditions, not `sleep(5000)`
  132. - React to state changes, don't guess timing
  133. - Tests complete when ready, not after arbitrary delays
  134. **3. Stateless & Parallelizable**
  135. - Tests run independently, any order
  136. - No shared state between tests
  137. - Can run in parallel (fast feedback)
  138. - Use cron jobs/semaphores only when unavoidable
  139. **4. No Order Dependency**
  140. - Every `it`/`describe`/`context` block works in isolation
  141. - Supports `.only` execution for debugging
  142. - Tests don't depend on previous tests
  143. **5. Self-Cleaning Tests**
  144. - Test sets up its own data
  145. - Test automatically deletes/deactivates entities created
  146. - No manual cleanup required
  147. **6. Tests Live Near Source Code**
  148. - Co-locate test files with code they validate
  149. - `component.tsx` → `component.spec.tsx` in same folder
  150. **7. Low Maintenance**
  151. - Minimize manual upkeep
  152. - Avoid brittle selectors
  153. - Use APIs to set up state, not UI clicks
  154. - Don't repeat UI actions
  155. {If role == QA:}
  156. **For QA Engineers:** These standards prevent the "test maintenance nightmare." Upfront investment in quality = long-term stability.
  157. {If role == Dev:}
  158. **For Developers:** Write tests you'd want to inherit. No flaky tests, no "run twice" culture, no mystery failures.
  159. {If role == Lead:}
  160. **For Tech Leads:** Enforce these standards in code review. Flaky test PRs don't merge. Period.
  161. {If role == VP:}
  162. **For VPs:** Definition of Done isn't perfectionism - it's engineering rigor. Flaky tests erode trust in CI/CD.
  163. **Documentation:** <https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/explanation/test-quality-standards/>
  164. **Knowledge Fragment:** test-quality.md has execution limits and criteria"
  165. ### 6. Teaching: Key Takeaways
  166. Present this content:
  167. "### 🎯 Session 2 Key Takeaways
  168. **1. Testing is Engineering**
  169. - Design before write
  170. - Maintain like production code
  171. - Apply engineering principles
  172. **2. Risk-Based Testing**
  173. - P0 = Critical (login, payment)
  174. - P1 = High (core workflows)
  175. - P2 = Medium (secondary features)
  176. - P3 = Low (tooltips, nice-to-have)
  177. - Prioritize based on Probability × Impact
  178. **3. Definition of Done**
  179. - No flaky tests (deterministic)
  180. - No hard waits (use waitFor)
  181. - Stateless & parallelizable
  182. - Self-cleaning tests
  183. - Low maintenance
  184. **4. Quality Standards = Engineering Rigor**
  185. - Not perfectionism, but reliability
  186. - Prevents test maintenance nightmares
  187. - Builds trust in CI/CD
  188. **You now understand the WHY behind TEA principles!**"
  189. ### 7. Quiz: Validate Understanding
  190. Display:
  191. "### ✅ Knowledge Check
  192. 3 questions to validate your understanding. Passing: ≥70% (2 of 3 correct)."
  193. **Question 1:**
  194. "**Question 1 of 3:**
  195. In the P0-P3 matrix, what priority level should login/authentication have?
  196. A) P3 - Low priority
  197. B) P2 - Medium priority
  198. C) P1 - High priority
  199. D) P0 - Critical priority
  200. Your answer (A, B, C, or D):"
  201. **Wait for response. Validate:**
  202. - Correct answer: D
  203. - If correct: "✅ Correct! Login/authentication is P0 - critical. Business fails if broken."
  204. - If incorrect: "❌ Login/authentication is P0 - Critical (D). It's high usage, high impact, and business-critical."
  205. **Store result**
  206. **Question 2:**
  207. "**Question 2 of 3:**
  208. What is the problem with using `sleep(5000)` instead of `waitFor` conditions?
  209. A) It makes tests slower
  210. B) It's a hard wait that doesn't react to state changes (violates DoD)
  211. C) It uses too much memory
  212. D) It's not supported in modern frameworks
  213. Your answer (A, B, C, or D):"
  214. **Wait for response. Validate:**
  215. - Correct answer: B
  216. - If correct: "✅ Correct! Hard waits don't react to state - they guess timing. Use `waitFor` to react to conditions."
  217. - If incorrect: "❌ The issue is that hard waits don't react to state changes (B). They guess timing instead of waiting for conditions. This violates TEA Definition of Done."
  218. **Store result**
  219. **Question 3:**
  220. "**Question 3 of 3:**
  221. What does "self-cleaning tests" mean in TEA Definition of Done?
  222. A) Tests automatically fix their own bugs
  223. B) Tests delete/deactivate entities they create during testing
  224. C) Tests run faster by cleaning up code
  225. D) Tests remove old test files
  226. Your answer (A, B, C, or D):"
  227. **Wait for response. Validate:**
  228. - Correct answer: B
  229. - If correct: "✅ Correct! Self-cleaning tests clean up their data - no manual cleanup needed."
  230. - If incorrect: "❌ Self-cleaning means tests delete/deactivate entities they created (B). No manual cleanup required."
  231. **Store result**
  232. **Calculate score:**
  233. - Total points / 3 \* 100 = score (0-100)
  234. **Display results:**
  235. "**Quiz Results:** {score}/100
  236. {If score >= 70:}
  237. ✅ **Passed!** You understand core testing concepts.
  238. {If score < 70:}
  239. ⚠️ **Below passing.** Would you like to:
  240. - **[R]** Review the content again
  241. - **[C]** Continue anyway (score will be recorded)
  242. {Wait for response if < 70, handle R or C}"
  243. ### 8. Generate Session Notes
  244. Create {sessionNotesFile} using {sessionNotesTemplate} with session-02 content including:
  245. - Teaching topics covered
  246. - TEA docs referenced
  247. - Knowledge fragments referenced (test-quality.md, probability-impact.md)
  248. - Quiz results
  249. - Key takeaways
  250. - Next recommended session based on experience level
  251. ### 9. Update Progress File (Session Complete)
  252. Load {progressFile} and update session-02-concepts:
  253. - Set `status: 'completed'`
  254. - Set `completed_date: {current_date}`
  255. - Set `score: {score}`
  256. - Set `notes_artifact: '{sessionNotesFile}'`
  257. Update progress metrics:
  258. - Increment `sessions_completed` by 1
  259. - Calculate `completion_percentage`
  260. - Set `next_recommended: 'session-03-architecture'`
  261. Update stepsCompleted array:
  262. - Append 'step-04-session-02'
  263. - Update lastStep
  264. Save the updated progress file.
  265. ### 10. Session Complete Message
  266. Display:
  267. "🎉 **Session 2 Complete!**
  268. **Your Score:** {score}/100
  269. **Session notes saved:** {sessionNotesFile}
  270. You now understand:
  271. - Testing as engineering philosophy
  272. - Risk-based testing (P0-P3 matrix)
  273. - TEA Definition of Done
  274. - Why quality standards matter
  275. **Next:** Session 3 (Architecture & Patterns) or explore any session from the menu.
  276. **Progress:** {completion_percentage}% complete ({sessions_completed} of 7 sessions)"
  277. ### 11. Present MENU OPTIONS
  278. Display: **Select an Option:** [A] Advanced Elicitation [P] Party Mode [C] Continue to Session Menu
  279. #### Menu Handling Logic:
  280. - IF A: Execute {advancedElicitationTask}, and when finished redisplay the menu
  281. - IF P: Execute {partyModeWorkflow}, and when finished redisplay the menu
  282. - IF C: Progress file already updated, then load, read entire file, then execute {nextStepFile}
  283. - IF Any other: help user, then redisplay menu
  284. ---
  285. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
  286. ### ✅ SUCCESS:
  287. - Teaching content presented (Testing as Engineering, Risk-based, DoD)
  288. - Examples adapted to user role
  289. - Quiz administered (3 questions)
  290. - Score calculated correctly
  291. - Session notes generated
  292. - Progress file updated
  293. - stepsCompleted array updated
  294. - User routed back to hub
  295. ### ❌ SYSTEM FAILURE:
  296. - Skipping quiz
  297. - Not adapting to role
  298. - Not generating notes
  299. - Not updating progress
  300. - Not routing to hub
  301. **Master Rule:** Teach, quiz, generate notes, update progress, return to hub.