使用说明
MCP检查器JUnit报告转换器
一个CLI工具,将MCP Checker测试结果JSON文件转换为JUnitXML格式,以便与CI/CD系统集成。
特性
- 将MCP检查器JSON测试结果转换为JUnitXML格式
- 支持从文件参数或stdin读取
- 按难度级别(易、中、难)分组测试
- 捕获断言失败和阶段错误
- 人类可读的输出格式
- 任务总结,包括状态和难度
- 断言通过/失败计数
- 工具调用历史和摘要
- 带要点的格式化时间线
- 长消息智能截断工具输出
- 保留所有测试输出和错误消息
安装
使用Go直接安装(推荐)
直接从存储库安装最新版本:
go install github.com/jrangelramos/mcpchecker-junit-report@latest
从源代码构建
克隆存储库并手动构建:
git clone https://github.com/jrangelramos/mcpchecker-junit-report.git
cd mcpchecker-junit-report
go build -o mcpchecker-junit-report
或使用Make:
make build
用法
从文件中读取
./mcpchecker-junit-report mcpchecker-eval-out.json > junit-report.xml
从stdin读取
cat mcpchecker-eval-out.json | mcpchecker-junit-report > junit-report.xml
JSON到JUnit映射
该工具将MCP检查器测试结果映射到JUnitXML,如下所示:
| MCP字段 | JUnit元素 | 描述 |
|---|---|---|
taskName |
testcase.name |
测试名称 |
taskPath |
testcase.classname |
从路径中提取(例如,“任务.创建函数”) |
difficulty |
testsuite.name |
按难度级别分组的测试 |
taskPassed |
error element |
如果为false,则测试执行失败 |
allAssertionsPassed |
failure element |
如果为false,则断言失败 |
taskOutput |
system-out |
测试的标准输出 |
taskError |
system-err |
错误消息 |
assertionResults |
failure.content |
失败断言的详细信息 |
| 相位输出 | system-err |
设置/代理/验证/清理阶段出现错误 |
JUnitXML输出结构
<testsuites>
<testsuite name="MCP Checker Tests - easy" tests="3" failures="0" errors="0">
<testcase name="create-function" classname="tasks.create-function">
<system-out>Perfect! I've successfully created...</system-out>
</testcase>
<!-- More test cases -->
</testsuite>
<testsuite name="MCP Checker Tests - medium" tests="2" failures="1" errors="0">
<!-- Medium difficulty tests -->
</testsuite>
</testsuites>
测试结果类别
- 通过:
taskPassed=true和allAssertionsPassed=true - 失败:
taskPassed=true但是allAssertionsPassed=false(断言失败) - 错误:
taskPassed=false(执行错误)
输出格式
这 system-out JUnitXML中的字段的格式是为了便于人类阅读,类似于 mcpchecker view:
Task: create-function
Path: /home/.../tasks/create-function/create-function.yaml
Difficulty: easy
Status: PASSED
Assertions: 3/3 passed
Call history: tools=1 (func-mcp:1 ok) resources=3
Tool output:
• func-mcp::create (ok)
Created node function in /tmp/myfunc
Timeline:
- note: Perfect! I've successfully created a Node.js Function named 'myfunc'
at `/tmp/myfunc` using the default http template.
- note: The Function has been initialized and is ready for development.
示例
给定输入JSON:
[
{
"taskName": "create-function",
"taskPath": "/path/to/tasks/create-function/task.yaml",
"taskPassed": true,
"difficulty": "easy",
"allAssertionsPassed": true,
"assertionResults": {
"toolsUsed": {"passed": true},
"minToolCalls": {"passed": true}
},
"callHistory": {
"ToolCalls": [{"serverName": "func-mcp", "name": "create", "success": true}]
},
"taskOutput": "Successfully created function"
}
]
该工具产生
<testsuites>
<testsuite name="MCP Checker Tests - easy" tests="1" failures="0" errors="0">
<testcase name="create-function" classname="tasks.create-function">
<system-out><![CDATA[Task: create-function
Path: /path/to/tasks/create-function/task.yaml
Difficulty: easy
Status: PASSED
Assertions: 1/1 passed
Call history: tools=1 (func-mcp:1 ok) resources=3
Tool output:
• func-mcp::create (ok)
Timeline:
Successfully created function
]]></system-out>
</testcase>
</testsuite>
</testsuites>