fix(exchange,case_validator),refactor(),feat(model): 解决 Pydantic 模型初始化与变量占位符的类型冲突,优化变量替换逻辑,重构 CaseInfo 模型并引入延迟校验机制

- 引入 SmartInt 和 SmartDict 类型,支持 YAML 占位符与业务类型的自动转换。
- 优化 CaseInfo 互斥校验逻辑,确保 request 与 api_action 二选一。
- 统一使用 Pydantic V2 的 model_config 规范。
- 将变量替换时机提前至模型实例化之前,支持占位符在校验前完成真实值注入,
保证了 int/bool 等字段的类型转换正确性。
- 优化断言渲染时机,支持响应提取值关联。
This commit is contained in:
2026-03-11 10:29:16 +08:00
parent 69a96a0060
commit 293b5160fe
39 changed files with 1359 additions and 1031 deletions

View File

@@ -0,0 +1,38 @@
feature: 页面状态
story: 状态
title: 查询状态信息
epic: 的点点滴滴
request:
method: get
url: /answer/api/v1/connector/info
headers:
Host: 119.91.19.171:40065
Accept-Language: en_US
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Referer: http://119.91.19.171:40065/users/login
Accept-Encoding: gzip, deflate
extract: # 提取变量
msg:
- "json"
- "$.msg"
- 0
validate:
- check: status_code # 检查的对象(或是变量名)
assert: equals # 断言方法
expect: 200 # 期望值
msg: "校验接口状态码" # 描述(可选)
- check: $.msg
assert: contains
expect: "Success"
msg: "检查返回消息"
parametrize: # 数据驱动测试
- [ "title","username","password","msg" ] # 变量名
- [ "测试1","user1","pass1","200" ] # 变量值
- [ "测试2","user2","pass2","300" ] # 变量值
- [ "测试3","user3","pass3","200" ] # 变量值
- [ "测试4","user4","pass4","200" ] # 变量值
- [ "测试5","user5","pass5","200" ] # 变量值