Files
2026-05-25 15:09:42 +08:00

77 lines
2.4 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://zeekerwatchman/schemas/testcase.json",
"title": "Test Case Schema",
"description": "从 IR 规则生成的测试用例格式",
"type": "object",
"required": ["testcases"],
"properties": {
"testcases": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/definitions/TestCase" }
},
"metadata": {
"type": "object",
"properties": {
"total": { "type": "integer" },
"ir_id": { "type": "string", "description": "来源 IR ID" },
"generated_at": { "type": "string", "format": "date-time" }
}
}
},
"definitions": {
"TestCase": {
"type": "object",
"required": ["id", "module", "case_title", "steps", "expected_result", "priority"],
"properties": {
"id": {
"type": "string",
"description": "唯一标识。格式: TC-{feature_id}-{seq},如 TC-PRD-001",
"pattern": "^TC-[A-Z]{2,8}-[0-9]{3}$",
"examples": ["TC-PRD-001", "TC-AUTH-002"]
},
"module": {
"type": "string",
"description": "所属模块名"
},
"feature": {
"type": "string",
"description": "功能点名称"
},
"case_title": {
"type": "string",
"description": "用例标题,格式: 正向/异常/边界-简短描述",
"examples": ["正向-上传md格式PRD成功", "异常-上传不支持的文件格式"]
},
"preconditions": {
"type": "string",
"description": "前置条件"
},
"steps": {
"type": "string",
"description": "测试步骤,Given-When-Then 格式,换行分隔",
"examples": ["Given 用户已登录\nWhen 上传.md文件\nThen 成功解析"]
},
"expected_result": {
"type": "string",
"description": "预期结果,必须量化可验证"
},
"priority": {
"type": "string",
"enum": ["P0", "P1", "P2"],
"description": "P0=冒烟/核心, P1=重要, P2=补充"
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "标签: 正向, 异常, 边界, 并发, 安全 等",
"examples": [["正向", "冒烟"], ["异常", "安全"]]
}
}
}
}
}