JUnit Failure Fingerprint
Use this skill to compress noisy JUnit failures/errors into repeatable fingerprints.
What this skill does
- - Scans one or more JUnit XML files
- Extracts only failing/error test cases
- Normalizes volatile tokens (IDs, numbers, line numbers, addresses, UUIDs)
- Generates stable fingerprint hashes for similar root-cause failures
- Emits grouped triage output (
text or json)
Inputs
Optional:
- -
JUNIT_GLOB (default: test-results/**/*.xml) - INLINECODE4 (default:
20) - INLINECODE6 (
text or json, default: text) - INLINECODE10 (default:
3) — number of normalized stack lines to include in fingerprint seed - INLINECODE12 (
0 or 1, default: 0) — exit non-zero when any failures/errors are found
Run
Text report:
CODEBLOCK0
JSON output for CI annotation/upload:
CODEBLOCK1
Run with bundled fixtures:
CODEBLOCK2
Output contract
- - Exit
0 by default (reporting mode) - Exit
1 if FAIL_ON_FAILURES=1 and at least one failure/error is found - In
text mode, prints summary + top fingerprints - In
json mode, prints machine-readable groups and per-case detail
JUnit 失败指纹
使用此技能可将杂乱的 JUnit 失败/错误压缩为可重复的指纹。
该技能的功能
- - 扫描一个或多个 JUnit XML 文件
- 仅提取失败的/错误的测试用例
- 规范化易变令牌(ID、数字、行号、地址、UUID)
- 为相似根因失败生成稳定的指纹哈希
- 输出分组分类结果(text 或 json)
输入
可选参数:
- - JUNITGLOB(默认值:test-results//*.xml)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- STACKLINES(默认值:3)—— 包含在指纹种子中的规范化堆栈行数
- FAILONFAILURES(0 或 1,默认值:0)—— 发现任何失败/错误时以非零状态退出
运行
文本报告:
bash
JUNIT_GLOB=artifacts/junit//*.xml \
TOP_N=15 \
bash skills/junit-failure-fingerprint/scripts/fingerprint-junit.sh
用于 CI 注释/上传的 JSON 输出:
bash
JUNIT_GLOB=artifacts/junit//*.xml \
OUTPUT_FORMAT=json \
FAILONFAILURES=1 \
bash skills/junit-failure-fingerprint/scripts/fingerprint-junit.sh
使用捆绑的测试数据运行:
bash
JUNIT_GLOB=skills/junit-failure-fingerprint/fixtures/*.xml \
bash skills/junit-failure-fingerprint/scripts/fingerprint-junit.sh
输出约定
- - 默认以 0 退出(报告模式)
- 如果 FAILONFAILURES=1 且至少发现一个失败/错误,则以 1 退出
- 在 text 模式下,打印摘要 + 顶部指纹
- 在 json 模式下,打印机器可读的分组和每个用例的详细信息