risk-based-testing
关于
This Claude skill prioritizes testing efforts by assessing risk through probability and impact analysis. It allocates testing resources proportionally, focusing 60% of effort on critical risks. Use it during test planning and resource allocation to maximize test coverage efficiency.
快速安装
Claude Code
推荐/plugin add https://github.com/proffesor-for-testing/agentic-qegit clone https://github.com/proffesor-for-testing/agentic-qe.git ~/.claude/skills/risk-based-testing在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Risk-Based Testing
<default_to_action> When planning tests or allocating testing resources:
- IDENTIFY risks: What can go wrong? What's the impact? What's the likelihood?
- CALCULATE risk: Risk = Probability × Impact (use 1-5 scale for each)
- PRIORITIZE: Critical (20+) → High (12-19) → Medium (6-11) → Low (1-5)
- ALLOCATE effort: 60% critical, 25% high, 10% medium, 5% low
- REASSESS continuously: New info, changes, production incidents
Quick Risk Assessment:
- Probability factors: Complexity, change frequency, developer experience, technical debt
- Impact factors: User count, revenue, safety, reputation, regulatory
- Dynamic adjustment: Production bugs increase risk; stable code decreases
Critical Success Factors:
- Test where bugs hurt most, not everywhere equally
- Risk is dynamic - reassess with new information
- Production data informs risk (shift-right feeds shift-left) </default_to_action>
Quick Reference Card
When to Use
- Planning sprint/release test strategy
- Deciding what to automate first
- Allocating limited testing time
- Justifying test coverage decisions
Risk Calculation
Risk Score = Probability (1-5) × Impact (1-5)
| Score | Priority | Effort | Action |
|---|---|---|---|
| 20-25 | Critical | 60% | Comprehensive testing, multiple techniques |
| 12-19 | High | 25% | Thorough testing, automation priority |
| 6-11 | Medium | 10% | Standard testing, basic automation |
| 1-5 | Low | 5% | Smoke test, exploratory only |
Probability Factors
| Factor | Low (1) | Medium (3) | High (5) |
|---|---|---|---|
| Complexity | Simple CRUD | Business logic | Algorithms, integrations |
| Change Rate | Stable 6+ months | Monthly changes | Weekly/daily changes |
| Developer Experience | Senior, domain expert | Mid-level | Junior, new to codebase |
| Technical Debt | Clean code | Some debt | Legacy, no tests |
Impact Factors
| Factor | Low (1) | Medium (3) | High (5) |
|---|---|---|---|
| Users Affected | Admin only | Department | All users |
| Revenue | None | Indirect | Direct (checkout) |
| Safety | Convenience | Data loss | Physical harm |
| Reputation | Internal | Industry | Public scandal |
Risk Assessment Workflow
Step 1: List Features/Components
Feature | Probability | Impact | Risk | Priority
--------|-------------|--------|------|----------
Checkout | 4 | 5 | 20 | Critical
User Auth | 3 | 5 | 15 | High
Admin Panel | 2 | 2 | 4 | Low
Search | 3 | 3 | 9 | Medium
Step 2: Apply Test Depth
await Task("Risk-Based Test Generation", {
critical: {
features: ['checkout', 'payment'],
depth: 'comprehensive',
techniques: ['unit', 'integration', 'e2e', 'performance', 'security']
},
high: {
features: ['auth', 'user-profile'],
depth: 'thorough',
techniques: ['unit', 'integration', 'e2e']
},
medium: {
features: ['search', 'notifications'],
depth: 'standard',
techniques: ['unit', 'integration']
},
low: {
features: ['admin-panel', 'settings'],
depth: 'smoke',
techniques: ['smoke-tests']
}
}, "qe-test-generator");
Step 3: Reassess Dynamically
// Production incident increases risk
await Task("Update Risk Score", {
feature: 'search',
event: 'production-incident',
previousRisk: 9,
newProbability: 5, // Increased due to incident
newRisk: 15 // Now HIGH priority
}, "qe-regression-risk-analyzer");
ML-Enhanced Risk Analysis
// Agent predicts risk using historical data
const riskAnalysis = await Task("ML Risk Analysis", {
codeChanges: changedFiles,
historicalBugs: bugDatabase,
prediction: {
model: 'gradient-boosting',
factors: ['complexity', 'change-frequency', 'author-experience', 'file-age']
}
}, "qe-regression-risk-analyzer");
// Output: 95% accuracy risk prediction per file
Agent Coordination Hints
Memory Namespace
aqe/risk-based/
├── risk-scores/* - Current risk assessments
├── historical-bugs/* - Bug patterns by area
├── production-data/* - Incident data for risk
└── coverage-map/* - Test depth by risk level
Fleet Coordination
const riskFleet = await FleetManager.coordinate({
strategy: 'risk-based-testing',
agents: [
'qe-regression-risk-analyzer', // Risk scoring
'qe-test-generator', // Risk-appropriate tests
'qe-production-intelligence', // Production feedback
'qe-quality-gate' // Risk-based gates
],
topology: 'sequential'
});
Integration with CI/CD
# Risk-based test selection in pipeline
- name: Risk Analysis
run: aqe risk-analyze --changes ${{ github.event.pull_request.files }}
- name: Run Critical Tests
if: risk.critical > 0
run: npm run test:critical
- name: Run High Tests
if: risk.high > 0
run: npm run test:high
- name: Skip Low Risk
if: risk.low_only
run: npm run test:smoke
Related Skills
- agentic-quality-engineering - Risk-aware agents
- context-driven-testing - Context affects risk
- regression-testing - Risk-based regression selection
- shift-right-testing - Production informs risk
Remember
Risk = Probability × Impact. Test where bugs hurt most. Critical gets 60%, low gets 5%. Risk is dynamic - reassess with new info. Production incidents raise risk scores.
With Agents: Agents calculate risk using ML on historical data, select risk-appropriate tests, and adjust scores from production feedback. Use agents to maintain dynamic risk profiles at scale.
GitHub 仓库
相关推荐技能
regression-testing
其他该Skill提供智能化的回归测试策略,帮助开发者在验证代码修复时确保现有功能不被破坏。它通过变更影响分析和风险评估,智能选择测试用例并优化执行顺序,避免全量测试的时间消耗。适用于CI/CD流程中的测试套件规划、变更验证和快速反馈场景,能显著提升回归测试效率。
testing-strategy-builder
元这个Skill为开发者提供构建全面测试策略的框架,包含测试计划模板、覆盖率目标和各类测试指导。它适用于新项目测试规划或现有代码库测试改进,涵盖单元测试、集成测试到性能测试的全流程。通过标准化测试结构和质量门控,帮助团队建立可靠的自动化测试体系。
test-automation-strategy
其他该Skill为开发者提供完整的测试自动化策略指导,涵盖测试金字塔设计、FIRST原则应用和CI/CD集成。它适用于构建新自动化框架或优化现有测试效率的场景,内置页面对象模式等最佳实践模板。通过结构化方法帮助团队建立可靠、可维护且与开发流程深度集成的自动化测试体系。
testability-scoring
其他该Skill基于10个内在可测试性原则,对Web应用进行AI驱动的可测试性评估。它使用Playwright并可选集成Vibium,帮助开发者评估测试就绪度、识别改进点并生成报告。适用于软件可测试性评估、测试准备度检查及生成可测试性改进建议等场景。
