mcpField
R
risk-based-testing

risk-based-testing

github.com/proffesor-for-testing测试与质量520122 次安装今天更新
代码仓库

关于 risk-based-testing

面向测试团队的风险规划技能,用于按组件风险安排覆盖范围和有限资源。它规定了评分、优先级区间、投入比例,并依据生产事故和稳定性持续重新评估。

主要功能

  1. 01评估概率与影响
  2. 02按风险区间排序
  3. 03按风险分配投入
  4. 04结合生产反馈重新评估

适用场景

  1. 01制定迭代或发布测试计划
  2. 02决定优先自动化的测试
  3. 03分配有限的测试时间

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill risk-based-testing

安装后在 Claude Code 中输入/risk-based-testing确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

evals/
risk-based-testing.yaml
schemas/
output.json
scripts/
validate-config.json

详细介绍

基于风险的测试

<default_to_action> 规划测试或分配测试资源时:

  1. 识别各组件的风险(概率和影响均采用 1-5 分制)
  2. 确定优先级:严重(20+)→ 高(12-19)→ 中(6-11)→ 低(1-5)
  3. 分配工作量:严重 60%,高 25%,中 10%,低 5%
  4. 持续重新评估:生产事故会提高风险;稳定的代码会降低风险 </default_to_action>

快速参考卡

适用场景
  • 规划迭代/发布测试策略
  • 决定优先自动化哪些内容
  • 分配有限的测试时间
  • 说明测试覆盖率决策的理由
按风险分值分配工作量
分值优先级工作量操作
20-25严重60%全面测试,采用多种技术
12-19高25%彻底测试,优先自动化
6-11中10%标准测试,基础自动化
1-5低5%冒烟测试,仅进行探索性测试

根据风险确定测试深度

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");
步骤 3:动态重新评估
// 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 增强型风险分析

// 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 协作提示

记忆命名空间
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
集群协作
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'
});

与 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

相关技能


请记住

使用 Agent: Agent 会利用历史数据通过 ML 计算风险,选择适合风险等级的测试,并根据生产环境反馈调整分值。借助 Agent 大规模维护动态风险档案。

评论

支持 Markdown