refactor-test

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Test Guardian Analysis

测试守护者分析

Verify existing test coverage and ensure tests will catch regressions during refactoring.
验证现有测试覆盖率,确保在重构过程中测试能够捕获回归问题。

Analysis Checklist

分析检查清单

Existing Coverage Analysis

现有覆盖率分析

  • Map test coverage for all files in the refactoring scope
  • Identify which behaviors are covered by unit vs integration tests
  • Check for tests that depend on implementation details (brittle tests)
  • Verify edge cases and error paths are covered
  • 绘制重构范围内所有文件的测试覆盖率图谱
  • 区分哪些行为由单元测试覆盖,哪些由集成测试覆盖
  • 检查依赖于实现细节的测试(脆弱测试)
  • 验证边界情况和错误路径是否已覆盖

Gap Identification

缺口识别

  • Find critical code paths with no test coverage
  • Identify untested boundary conditions and error handling
  • Detect missing integration tests between affected modules
  • Check for untested concurrent or async behavior
  • 找出无测试覆盖的关键代码路径
  • 识别未测试的边界条件和错误处理逻辑
  • 检测受影响模块之间缺失的集成测试
  • 检查未测试的并发或异步行为

Pre-Refactoring Tests

重构前测试建议

  • Recommend characterization tests to capture current behavior
  • Define golden master tests for complex output verification
  • Suggest contract tests for public API boundaries
  • Plan snapshot tests for UI components affected by changes
  • 推荐特征化测试以捕获当前行为
  • 为复杂输出验证定义黄金主测试
  • 建议针对公共API边界的契约测试
  • 为受变更影响的UI组件规划快照测试

Verification Checkpoints

验证检查点

  • Define test gates between each migration step
  • Specify performance benchmarks to verify no regression
  • Plan smoke tests for critical user journeys
  • Establish monitoring checks for post-deployment verification
  • 在每个迁移步骤之间定义测试关卡
  • 指定性能基准以验证无性能回归
  • 规划关键用户旅程的冒烟测试
  • 建立部署后的监控检查机制

Test Refactoring Readiness

测试重构就绪性

  • Identify brittle tests that will break from structural changes
  • Recommend test rewrites to depend on behavior not implementation
  • Check test isolation to prevent cascade failures
  • Verify test data setup is independent of internal structure
  • 识别会因结构变更而失效的脆弱测试
  • 建议重写测试,使其依赖于行为而非实现细节
  • 检查测试隔离性以防止连锁故障
  • 验证测试数据设置独立于内部结构

Output Format

输出格式

Report findings with impact ratings:
ImpactDescription
BreakingMissing tests for critical path, refactoring unsafe to start
HighSignificant coverage gap that must be filled before proceeding
MediumCoverage gap that should be addressed during refactoring
LowMinor gap, acceptable risk with manual verification
以影响评级呈现分析结果:
影响等级描述
阻断级关键路径缺失测试,重构无法安全启动
高风险存在重大覆盖缺口,必须在开始前填补
中风险存在覆盖缺口,应在重构过程中解决
低风险轻微缺口,可通过人工验证接受该风险