Workflow ID: _bmad/bmm/testarch/test-design
Version: 4.0 (BMad v6)
Plans comprehensive test coverage strategy with risk assessment, priority classification, and execution ordering. This workflow operates in two modes:
The workflow auto-detects which mode to use based on project phase.
Critical: Determine mode before proceeding.
Check for sprint-status.yaml
{output_folder}/bmm-sprint-status.yaml exists → Epic-Level Mode (Phase 4)Check workflow-status.yaml
{output_folder}/bmm-workflow-status.yamlimplementation-readiness: required or implementation-readiness: recommended → System-Level Mode (Phase 3)Mode-Specific Requirements
System-Level Mode (Phase 3 - Testability Review):
{output_folder}/test-design-system.mdEpic-Level Mode (Phase 4 - Per-Epic Planning):
{output_folder}/test-design-epic-{epic_num}.mdHalt Condition: If mode cannot be determined or required files missing, HALT and notify user with missing prerequisites.
Mode-Specific Loading:
Read Architecture Documentation
Check Playwright Utils Flag
Read {config_source} and check config.tea_use_playwright_utils.
If true, note that @seontechnologies/playwright-utils provides utilities for test implementation. Reference in test design where relevant.
Critical: Consult {project-root}/_bmad/bmm/testarch/tea-index.csv to load:
nfr-criteria.md - NFR validation approach (security, performance, reliability, maintainability)test-levels-framework.md - Test levels strategy guidancerisk-governance.md - Testability risk identificationtest-quality.md - Quality standards and Definition of DoneRead Requirements Documentation
Load Architecture Context
Analyze Existing Test Coverage
{test_dir}Load Knowledge Base Fragments (Epic-Level)
Critical: Consult {project-root}/_bmad/bmm/testarch/tea-index.csv to load:
risk-governance.md - Risk classification framework (6 categories: TECH, SEC, PERF, DATA, BUS, OPS), automated scoring, gate decision engine, owner tracking (625 lines, 4 examples)probability-impact.md - Risk scoring methodology (probability × impact matrix, automated classification, dynamic re-assessment, gate integration, 604 lines, 4 examples)test-levels-framework.md - Test level selection guidance (E2E vs API vs Component vs Unit with decision matrix, characteristics, when to use each, 467 lines, 4 examples)test-priorities-matrix.md - P0-P3 prioritization criteria (automated priority calculation, risk-based mapping, tagging strategy, time budgets, 389 lines, 2 examples)Halt Condition (Epic-Level only): If story data or acceptance criteria are missing, check if brownfield exploration is needed. If neither requirements NOR exploration possible, HALT with message: "Epic-level test design requires clear requirements, acceptance criteria, or brownfield app URL for exploration"
Skip this step if Epic-Level Mode. This step only executes in System-Level Mode.
Evaluate architecture against these criteria:
Controllability:
Observability:
Reliability:
From PRD NFRs and architecture decisions, identify quality requirements that:
Score each ASR using risk matrix (probability × impact).
Based on architecture (mobile, web, API, microservices, monolith):
For each NFR category:
Identify architecture decisions that harm testability:
Critical: If testability concerns are blockers (e.g., "Architecture makes performance testing impossible"), document as CONCERNS or FAIL recommendation for gate check.
Write to {output_folder}/test-design-system.md containing:
# System-Level Test Design
## Testability Assessment
- Controllability: [PASS/CONCERNS/FAIL with details]
- Observability: [PASS/CONCERNS/FAIL with details]
- Reliability: [PASS/CONCERNS/FAIL with details]
## Architecturally Significant Requirements (ASRs)
[Risk-scored quality requirements]
## Test Levels Strategy
- Unit: [X%] - [Rationale]
- Integration: [Y%] - [Rationale]
- E2E: [Z%] - [Rationale]
## NFR Testing Approach
- Security: [Approach with tools]
- Performance: [Approach with tools]
- Reliability: [Approach with tools]
- Maintainability: [Approach with tools]
## Test Environment Requirements
[Infrastructure needs based on deployment architecture]
## Testability Concerns (if any)
[Blockers or concerns that should inform solutioning gate check]
## Recommendations for Sprint 0
[Specific actions for *framework and *ci workflows]
After System-Level Mode: Skip to Step 4 (Generate Deliverables) - Steps 2-3 are epic-level only.
Determine mode based on context:
Requirements-Based Mode (DEFAULT):
Exploratory Mode (OPTIONAL - Brownfield):
If requirements are clear:
If exploring brownfield application:
A. Check MCP Availability
If config.tea_use_mcp_enhancements is true AND Playwright MCP tools available:
If MCP unavailable OR config.tea_use_mcp_enhancements is false:
B. MCP-Assisted Exploration (If MCP Tools Available)
Use Playwright MCP browser tools to explore UI:
Setup:
1. Use planner_setup_page to initialize browser
2. Navigate to {exploration_url}
3. Capture initial state with browser_snapshot
Exploration Process:
4. Use browser_navigate to explore different pages
5. Use browser_click to interact with buttons, links, forms
6. Use browser_hover to reveal hidden menus/tooltips
7. Capture browser_snapshot at each significant state
8. Take browser_screenshot for documentation
9. Monitor browser_console_messages for JavaScript errors
10. Track browser_network_requests to identify API calls
11. Map user flows and interactive elements
12. Document discovered functionality
Discovery Documentation:
Convert to Test Scenarios:
C. Manual Exploration Fallback (If MCP Unavailable)
If Playwright MCP is not available:
Notify User:
Exploratory mode enabled but Playwright MCP unavailable.
**Manual exploration required:**
1. Open application at: {exploration_url}
2. Explore all pages, workflows, and features
3. Document findings in markdown:
- List of pages/features discovered
- User journeys identified
- API endpoints observed (DevTools Network tab)
- JavaScript errors noted (DevTools Console)
- Critical workflows mapped
4. Provide exploration findings to continue workflow
**Alternative:** Disable exploratory_mode and provide requirements documentation
Wait for user to provide exploration findings, then:
After mode selection (Requirements-Based OR Exploratory):
Filter requirements to isolate actual risks (not just features):
Use these standard risk categories:
TECH (Technical/Architecture):
SEC (Security):
PERF (Performance):
DATA (Data Integrity):
BUS (Business Impact):
OPS (Operations):
Rate likelihood (1-3):
Rate severity (1-3):
Calculate Risk Score
Risk Score = Probability × Impact
Scores:
1-2: Low risk (monitor)
3-4: Medium risk (plan mitigation)
6-9: High risk (immediate mitigation required)
Highlight High-Priority Risks
Flag all risks with score ≥6 for immediate attention.
If evidence is missing or assumptions required:
For each high-priority risk:
Convert each acceptance criterion into atomic test scenarios:
Knowledge Base Reference: test-levels-framework.md
Map requirements to optimal test levels (avoid duplication):
E2E (End-to-End):
API (Integration):
Component:
Unit:
Avoid duplicate coverage: Don't test same behavior at multiple levels unless necessary.
Knowledge Base Reference: test-priorities-matrix.md
P0 (Critical):
P1 (High):
P2 (Medium):
P3 (Low):
For each test scenario, identify:
Recommend test execution sequence:
Use template structure:
| Risk ID | Category | Description | Probability | Impact | Score | Mitigation |
| ------- | -------- | ----------- | ----------- | ------ | ----- | --------------- |
| R-001 | SEC | Auth bypass | 2 | 3 | 6 | Add authz check |
Create Coverage Matrix
| Requirement | Test Level | Priority | Risk Link | Test Count | Owner |
| ----------- | ---------- | -------- | --------- | ---------- | ----- |
| Login flow | E2E | P0 | R-001 | 3 | QA |
Document Execution Order
### Smoke Tests (<5 min)
- Login successful
- Dashboard loads
### P0 Tests (<10 min)
- [Full P0 list]
### P1 Tests (<30 min)
- [Full P1 list]
Include Resource Estimates
### Test Effort Estimates
- P0 scenarios: 15 tests × 2 hours = 30 hours
- P1 scenarios: 25 tests × 1 hour = 25 hours
- P2 scenarios: 40 tests × 0.5 hour = 20 hours
- **Total:** 75 hours (~10 days)
Add Gate Criteria
### Quality Gate Criteria
- All P0 tests pass (100%)
- P1 tests pass rate ≥95%
- No high-risk (score ≥6) items unmitigated
- Test coverage ≥80% for critical paths
Write to Output File
Save to {output_folder}/test-design-epic-{epic_num}.md using template structure.
TECH (Technical/Architecture):
SEC (Security):
PERF (Performance):
DATA (Data Integrity):
BUS (Business Impact):
OPS (Operations):
Probability × Impact = Risk Score
Examples:
Threshold: Scores ≥6 require immediate mitigation.
Avoid duplication:
Tradeoffs:
P0 criteria (all must be true):
P1 criteria:
P2/P3: Everything else, prioritized by value
Core Fragments (Auto-loaded in Step 1):
risk-governance.md - Risk classification (6 categories), automated scoring, gate decision engine, coverage traceability, owner tracking (625 lines, 4 examples)probability-impact.md - Probability × impact matrix, automated classification thresholds, dynamic re-assessment, gate integration (604 lines, 4 examples)test-levels-framework.md - E2E vs API vs Component vs Unit decision framework with characteristics matrix (467 lines, 4 examples)test-priorities-matrix.md - P0-P3 automated priority calculation, risk-based mapping, tagging strategy, time budgets (389 lines, 2 examples)Reference for Test Planning:
selective-testing.md - Execution strategy: tag-based, spec filters, diff-based selection, promotion rules (727 lines, 4 examples)fixture-architecture.md - Data setup patterns: pure function → fixture → mergeTests, auto-cleanup (406 lines, 5 examples)Manual Reference (Optional):
tea-index.csv to find additional specialized fragments as neededCritical principle: Base risk assessment on evidence, not speculation.
Evidence sources:
Avoid:
When uncertain: Document assumptions and request clarification from user.
After completing this workflow, provide a summary:
## Test Design Complete
**Epic**: {epic_num}
**Scope**: {design_level}
**Risk Assessment**:
- Total risks identified: {count}
- High-priority risks (≥6): {high_count}
- Categories: {categories}
**Coverage Plan**:
- P0 scenarios: {p0_count} ({p0_hours} hours)
- P1 scenarios: {p1_count} ({p1_hours} hours)
- P2/P3 scenarios: {p2p3_count} ({p2p3_hours} hours)
- **Total effort**: {total_hours} hours (~{total_days} days)
**Test Levels**:
- E2E: {e2e_count}
- API: {api_count}
- Component: {component_count}
- Unit: {unit_count}
**Quality Gate Criteria**:
- P0 pass rate: 100%
- P1 pass rate: ≥95%
- High-risk mitigations: 100%
- Coverage: ≥80%
**Output File**: {output_file}
**Next Steps**:
1. Review risk assessment with team
2. Prioritize mitigation for high-risk items (score ≥6)
3. Run `*atdd` to generate failing tests for P0 scenarios (separate workflow; not auto-run by `*test-design`)
4. Allocate resources per effort estimates
5. Set up test data factories and fixtures
After completing all steps, verify:
Refer to checklist.md for comprehensive validation criteria.