ln-632-test-e2e-priority-auditor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

E2E Critical Coverage Auditor (L3 Worker)

E2E关键覆盖审计工作者(L3级)

Specialized worker auditing E2E test coverage for critical paths (risk-based).
专门用于基于风险评估的关键路径E2E测试覆盖审计的工作者。

Purpose & Scope

目标与范围

  • Worker in ln-630 coordinator pipeline
  • Audit E2E Critical Coverage (Category 2: High Priority)
  • Validate E2E coverage for critical paths (Money/Security/Data Priority ≥20)
  • Validate E2E coverage for core user journeys (Priority 15-19)
  • Identify wasteful E2E tests (Usefulness Score <15)
  • Calculate compliance score (X/10)
  • ln-630协调器流水线中的工作者
  • 审计E2E关键覆盖(类别2:高优先级)
  • 验证关键路径的E2E覆盖情况(资金/安全/数据优先级≥20)
  • 验证核心用户旅程的E2E覆盖情况(优先级15-19)
  • 识别无意义的E2E测试(实用度评分<15)
  • 计算合规评分(X/10)

Inputs (from Coordinator)

输入(来自协调器)

Receives
contextStore
with risk-based testing philosophy, tech stack, codebase structure, test file list.
接收包含基于风险的测试理念、技术栈、代码库结构、测试文件列表的
contextStore

Workflow

工作流程

  1. Parse context (critical paths, user journeys)
  2. Identify critical paths in codebase (Money, Security, Data)
  3. Identify core user journeys (multi-step flows)
  4. Check E2E coverage for critical paths (Priority ≥20)
  5. Check E2E coverage for user journeys (Priority 15-19)
  6. Validate existing E2E tests (Usefulness Score ≥15)
  7. Collect findings
  8. Calculate score
  9. Return JSON
  1. 解析上下文(关键路径、用户旅程)
  2. 在代码库中识别关键路径(资金、安全、数据)
  3. 识别核心用户旅程(多步骤流程)
  4. 检查关键路径的E2E覆盖情况(优先级≥20)
  5. 检查用户旅程的E2E覆盖情况(优先级15-19)
  6. 验证现有E2E测试(实用度评分≥15)
  7. 收集审计结果
  8. 计算评分
  9. 返回JSON

Audit Rules

审计规则

1. Critical Path E2E Coverage

1. 关键路径E2E覆盖

Rule: Every critical path MUST have E2E test
Critical Paths (Priority ≥20):
  • Money (Priority 25): Payment processing, refunds, discounts, tax calculation
  • Security (Priority 25): Login, auth, password reset, token refresh, permissions
  • Data Export (Priority 20): Reports, CSV generation, data migration
Detection:
  1. Scan codebase for critical keywords:
    payment
    ,
    refund
    ,
    login
    ,
    auth
    ,
    export
  2. Extract critical functions/endpoints
  3. Check if E2E test exists for each critical path
  4. Missing E2E for Priority ≥20 → CRITICAL severity
Severity:
  • CRITICAL: No E2E for Priority 25 (Money, Security)
  • HIGH: No E2E for Priority 20 (Data Export)
Recommendation: Add E2E tests for critical paths immediately
Effort: M
规则: 每个关键路径必须有对应的E2E测试
关键路径(优先级≥20):
  • 资金类(优先级25):支付处理、退款、折扣、税费计算
  • 安全类(优先级25):登录、认证、密码重置、令牌刷新、权限管理
  • 数据导出(优先级20):报表、CSV生成、数据迁移
检测方式:
  1. 扫描代码库中的关键关键词:
    payment
    refund
    login
    auth
    export
  2. 提取关键函数/端点
  3. 检查每个关键路径是否存在对应的E2E测试
  4. 优先级≥20的路径缺少E2E测试 → 严重级别为CRITICAL
严重级别:
  • CRITICAL(严重): 优先级25的路径(资金、安全)缺少E2E测试
  • HIGH(高): 优先级20的路径(数据导出)缺少E2E测试
建议: 立即为关键路径添加E2E测试
工作量: M(中等)

2. Core User Journey E2E Coverage

2. 核心用户旅程E2E覆盖

Rule: Multi-step critical flows MUST have E2E test
Core Journeys (Priority 15-19):
  • Registration → Email verification → First login (Priority 16)
  • Product search → Add to cart → Checkout (Priority 18)
  • File upload → Processing → Download result (Priority 15)
Detection:
  1. Identify multi-step flows in routes/controllers
  2. Check if end-to-end journey test exists
  3. Missing E2E for Priority ≥15 → HIGH severity
Severity:
  • HIGH: Missing E2E for core user journey (Priority ≥15)
  • MEDIUM: Incomplete journey coverage (only partial steps tested)
Recommendation: Add end-to-end journey tests
Effort: M-L
规则: 多步骤关键流程必须有对应的E2E测试
核心用户旅程(优先级15-19):
  • 注册 → 邮箱验证 → 首次登录(优先级16)
  • 商品搜索 → 加入购物车 → 结账(优先级18)
  • 文件上传 → 处理 → 下载结果(优先级15)
检测方式:
  1. 在路由/控制器中识别多步骤流程
  2. 检查是否存在端到端的旅程测试
  3. 优先级≥15的旅程缺少E2E测试 → 严重级别为HIGH
严重级别:
  • HIGH(高): 核心用户旅程(优先级≥15)缺少E2E测试
  • MEDIUM(中): 旅程覆盖不完整(仅测试了部分步骤)
建议: 添加端到端的用户旅程测试
工作量: M-L(中等至大型)

3. E2E Test Usefulness Validation

3. E2E测试实用度验证

Rule: Every E2E test MUST justify Priority ≥15
Check: For each E2E test, calculate Usefulness Score = Impact × Probability
  • If Score <15 → Flag as "Potentially wasteful E2E"
  • Recommendation: Convert to Integration or Unit test (cheaper)
Example:
  • E2E test for "API returns 200 OK" → Impact 2, Probability 1 → Score 2 → WASTEFUL
  • E2E test for "Payment with discount calculates correctly" → Impact 5, Probability 5 → Score 25 → VALUABLE
Severity:
  • MEDIUM: E2E test with Usefulness Score <15
  • LOW: E2E test with Score 10-14 (review needed)
Recommendation: Convert low-value E2E to Integration/Unit or remove
Effort: S
规则: 每个E2E测试的优先级必须≥15以证明其存在价值
检查方式: 对每个E2E测试,计算实用度评分=影响程度×发生概率
  • 若评分<15 → 标记为“可能无意义的E2E测试”
  • 建议:转换为集成测试或单元测试(成本更低)
示例:
  • 测试“API返回200 OK”的E2E测试 → 影响程度2,发生概率1 → 评分2 → 无意义
  • 测试“带折扣的支付计算正确”的E2E测试 → 影响程度5,发生概率5 → 评分25 → 有价值
严重级别:
  • MEDIUM(中): 实用度评分<15的E2E测试
  • LOW(低): 评分10-14的E2E测试(需要复查)
建议: 将低价值的E2E测试转换为集成/单元测试或直接移除
工作量: S(小型)

Scoring Algorithm

评分算法

See
shared/references/audit_scoring.md
for unified formula and score interpretation.
Severity mapping:
  • Missing E2E for Priority 25 (Money, Security) → CRITICAL
  • Missing E2E for Priority 20 (Data Export) → HIGH
  • Missing E2E for Priority 15-19 (Core Journeys) → HIGH
  • Wasteful E2E (Score <15) → MEDIUM
  • Incomplete journey coverage → LOW
统一公式和评分说明请参见
shared/references/audit_scoring.md
严重级别映射:
  • 优先级25的路径(资金、安全)缺少E2E测试 → CRITICAL
  • 优先级20的路径(数据导出)缺少E2E测试 → HIGH
  • 优先级15-19的核心旅程缺少E2E测试 → HIGH
  • 无意义的E2E测试(评分<15) → MEDIUM
  • 旅程覆盖不完整 → LOW

Output Format

输出格式

Return JSON to coordinator:
json
{
  "category": "E2E Critical Coverage",
  "score": 6,
  "total_issues": 8,
  "critical": 2,
  "high": 3,
  "medium": 2,
  "low": 1,
  "checks": [
    {"id": "critical_path_coverage", "name": "Critical Path Coverage", "status": "failed", "details": "Missing E2E for 2 Priority 25 paths (payment, auth)"},
    {"id": "user_journey_coverage", "name": "User Journey Coverage", "status": "warning", "details": "1 of 3 core journeys missing E2E"},
    {"id": "edge_case_coverage", "name": "Edge Case Coverage", "status": "passed", "details": "Error scenarios covered in existing E2E"}
  ],
  "findings": [
    {
      "severity": "CRITICAL",
      "location": "routes/payment.ts:45",
      "issue": "No E2E test for payment processing (POST /payment, Priority 25)",
      "principle": "E2E Critical Coverage / Money Flow",
      "recommendation": "Add E2E: successful payment + failed payment scenarios",
      "effort": "M"
    },
    {
      "severity": "HIGH",
      "location": "routes/auth.ts + routes/users.ts",
      "issue": "Missing E2E for user journey: Registration → Email verification → First login (Priority 16)",
      "principle": "E2E Critical Coverage / Core Journey",
      "recommendation": "Add E2E test covering full registration flow",
      "effort": "L"
    },
    {
      "severity": "MEDIUM",
      "location": "users.test.ts:23",
      "issue": "Low-value E2E test 'GET /users returns 200' (Usefulness Score 4 < 15)",
      "principle": "E2E Critical Coverage / Wasteful Test",
      "recommendation": "Convert to Integration test or remove",
      "effort": "S"
    }
  ]
}
向协调器返回JSON:
json
{
  "category": "E2E Critical Coverage",
  "score": 6,
  "total_issues": 8,
  "critical": 2,
  "high": 3,
  "medium": 2,
  "low": 1,
  "checks": [
    {"id": "critical_path_coverage", "name": "Critical Path Coverage", "status": "failed", "details": "Missing E2E for 2 Priority 25 paths (payment, auth)"},
    {"id": "user_journey_coverage", "name": "User Journey Coverage", "status": "warning", "details": "1 of 3 core journeys missing E2E"},
    {"id": "edge_case_coverage", "name": "Edge Case Coverage", "status": "passed", "details": "Error scenarios covered in existing E2E"}
  ],
  "findings": [
    {
      "severity": "CRITICAL",
      "location": "routes/payment.ts:45",
      "issue": "No E2E test for payment processing (POST /payment, Priority 25)",
      "principle": "E2E Critical Coverage / Money Flow",
      "recommendation": "Add E2E: successful payment + failed payment scenarios",
      "effort": "M"
    },
    {
      "severity": "HIGH",
      "location": "routes/auth.ts + routes/users.ts",
      "issue": "Missing E2E for user journey: Registration → Email verification → First login (Priority 16)",
      "principle": "E2E Critical Coverage / Core Journey",
      "recommendation": "Add E2E test covering full registration flow",
      "effort": "L"
    },
    {
      "severity": "MEDIUM",
      "location": "users.test.ts:23",
      "issue": "Low-value E2E test 'GET /users returns 200' (Usefulness Score 4 < 15)",
      "principle": "E2E Critical Coverage / Wasteful Test",
      "recommendation": "Convert to Integration test or remove",
      "effort": "S"
    }
  ]
}

Reference Files

参考文件

  • Audit scoring formula:
    shared/references/audit_scoring.md
  • Audit output schema:
    shared/references/audit_output_schema.md

Version: 3.0.0 Last Updated: 2025-12-23
  • 审计评分公式:
    shared/references/audit_scoring.md
  • 审计输出 schema:
    shared/references/audit_output_schema.md

版本: 3.0.0 最后更新日期: 2025-12-23