Compare coverage between branches, highlight uncovered lines in PR diff, and suggest test cases. / 对比分支间覆盖率,高亮 PR 差异中未覆盖代码行并建议测试用例。
---
name: test-coverage-diff
description: "Compare coverage between branches, highlight uncovered lines in PR diff, and suggest test cases. / 对比分支间覆盖率,高亮 PR 差异中未覆盖代码行并建议测试用例。"
version: 1.0.0
topics: [testing,coverage,code-review,quality,测试覆盖率,代码质量]
metadata:
openclaw:
requires:
bins:
- bash
- curl
emoji: "🧪"
homepage: https://kingai.work/
install: []
---
# 🧪 Test Coverage Diff / 测试覆盖率差异分析
> Compare coverage between branches, highlight uncovered lines in PR diff, and suggest test cases. / 对比分支间覆盖率,高亮 PR 差异中未覆盖代码行并建议测试用例。
> 🦁 **由 KingAI.Work 出品** — 智能进化|vip@kingai.work
---
## Overview / 概览
• Instantly compare coverage between any two branches, exposing gaps before merge / 即刻对比任意分支覆盖率,在合并前精准暴露测试盲区,守护上线质量
• Highlight uncovered lines in your PR diff with color-coded inline annotations / 在 PR 差异中高亮未覆盖代码行,使用色彩标记内联注释,让问题一目了然
• Suggest targeted test cases based on uncovered diff logic / 基于未覆盖的差异逻辑智能推荐针对性测试用例,减少人工回溯成本
• Support multi-language coverage data (Java, Python, JavaScript, Go) / 支持多语言覆盖率数据(Java, Python, JavaScript, Go),团队统一使用零门槛
• (Pro) Inject test recommendations directly into your CI pipeline for automated review / (Pro)将测试建议直接注入 CI 流水线,自动化审查无需人工介入
• (Pro) Generate performance heatmaps of coverage trends over release cycles / (Pro)生成跨发布周期的覆盖率趋势热力图,为长期质量策略提供数据支撑
## How It Works / 原理
```bash
# Step 1 — check environment
which bash curl && echo "Ready"
# Step 2 — run the tool
git diff main feature/new-auth -- test/ | test-coverage-diff --before main This shows which lines in the new auth feature are untested compared to main branch. / 展示新认证功能相比主分支有哪些代码行未被测试覆盖。
# Step 3 — review output
echo "Done — check the generated output"
```
## Example Scenarios / 示例场景
• Rapid feature branch review: A developer has a 300-line diff in a hotfix branch. The tool pinpoints exactly which 12 lines lack coverage, saving hours of manual inspection. / 快速功能分支审查:开发者在热修复分支有 300 行差异。工具精准定位出 12 行未覆盖代码,节省数小时人工排查。
• CI gatekeeping: Before merging, a team's pipeline runs coverage diff analysis and blocks PRs that drop overall coverage by more than 2%. / CI 门禁管控:合并前团队流水线运行覆盖率差异分析,阻止整体覆盖率下降超过 2% 的 PR。
• Tech debt reduction: A legacy module has low coverage. Using diff comparison, the QA team prioritizes tests for newly added code instead of rewriting everything. / 技术债消减:旧模块覆盖率低。通过差异对比,QA 团队优先为新增代码编写测试,而非重写全部。
## Plans / 版本
| Capability | Free | Pro |
|-----------|:----:|:---:|
| Basics / 基础 | ✅ | ✅ |
| Automation / 自动化 | — | ✅ |
| AI / AI 功能 | — | ✅ |
| Support | Community | Priority |
• Pro unlocks automated CI annotations blocking PRs with risky uncovered code.
• Pro 解锁自动 CI 注释,可拦截存在高风险未覆盖代码的 PR。
• Pro gives you per-sprint coverage trend reports for team performance tracking.
• Pro 提供每个迭代的覆盖率趋势报告,助力团队质量绩效可视化。
• Pro enables one-click test case generation from diff context, not just a suggestion.
• Pro 支持从差异上下文一键生成测试用例,而不仅仅是给出建议。\n\n
📦 *Published by King AI — kingai.work*
don't have the plugin yet? install it then click "run inline in claude" again.