{ "module": "tests", "version": "1.0", "purpose": "Dashboard 'K 测试' tab 展示系统测试运行结果,包含 Passed/Failed/Expected Fail 分类汇总。", "ui_location": "Principles 菜单 → K 测试 tab", "human_help": { "title": "K 测试 — 测试报告", "description": [ "本 tab 展示系统各模块的自动化测试结果。", "测试用例通过 /api/tests 获取,按 Passed / Failed / Expected Fail 分类展示。", "Expected Fail 表示已知但可接受的失败(不影响整体功能),Real Fail 需要关注。" ], "usage": [ "1. 查看顶部的概要卡片(Total / Passed / Failed)了解整体情况", "2. 检查 Expected Fail 区域 — 已知问题,yellow 标记", "3. 检查 Real Fail 区域 — 需要修复的问题,red 标记", "4. 查看 Passed 列表确认正常功能不受影响" ], "troubleshooting": [ "如果数据加载失败,检查 dashboard.py 是否运行在 5803 端口", "如果所有测试都 Failed:检查 /api/tests 端点是否返回正确格式的数据" ], "related": "G 规范定义模块应满足的开发规范,H 需求定义产品层验收条件" }, "ai_spec": { "apis": [ {"method": "GET", "path": "/api/tests", "returns": "{ok, summary{total,passed,failed}, tests[{name,ok,detail,expected}], time}"} ], "dependencies": [ "dashboard.py 的 test runner 或外部测试脚本提供数据" ], "constraints": [ "测试列表按 expected 字段分类展示 — expected=true 的失败归类为 'Expected Fail'", "expected=false 且 failed 的测试归类为 'Real Fail',会以红框突出显示", "summary 卡片显示 total / passed / failed 但不含 expected 维度", "支持自定义测试套件通过 API 注入" ], "tests": [ {"id": "T01", "name": "/api/tests 返回完整测试结果", "endpoint": "GET /api/tests"}, {"id": "T02", "name": "测试结果正确分类 (Passed/Failed/Expected)", "endpoint": "n/a (data validation)"} ], "related_files": [ "gateway/scripts/dashboard.py — /api/tests 端点", "gateway/scripts/templates/dashboard.html — fTests() 渲染函数", "gateway/scripts/specs/tests.json — 本 spec 文件" ] } }