主要改进: - 新增统一测试器 (universal_tester.py) 支持多种测试模式 - 优化测试报告生成器,支持汇总报告和操作截图 - 增强探索器 DFS 算法和状态指纹识别 - 新增智能测试配置 (smart_test.yaml) - 改进 AI 模型集成 (GLM/Gemini 支持) - 添加开发调试工具和文档
This commit is contained in:
183
tests/configs/enterprise_system.yaml
Normal file
183
tests/configs/enterprise_system.yaml
Normal file
@@ -0,0 +1,183 @@
|
||||
name: 企业系统全功能测试
|
||||
url: "http://47.99.105.253:8084"
|
||||
mode: hybrid
|
||||
model: glm
|
||||
headless: false
|
||||
|
||||
login:
|
||||
username: "admin"
|
||||
password: "password"
|
||||
submit_button: "登录"
|
||||
|
||||
# 探索配置 - 全面测试所有功能
|
||||
explore_config:
|
||||
max_depth: 5 # 探索深度,确保覆盖所有层级
|
||||
max_clicks: 200 # 充足的点击次数
|
||||
focus_patterns: # 引导 AI 重点测试这些功能
|
||||
- "管理"
|
||||
- "设置"
|
||||
- "新增"
|
||||
- "编辑"
|
||||
- "查询"
|
||||
- "审核"
|
||||
- "提交"
|
||||
- "导出"
|
||||
- "详情"
|
||||
- "列表"
|
||||
dangerous_patterns: # 发现但不点击的危险操作
|
||||
- "删除"
|
||||
- "退出"
|
||||
- "注销"
|
||||
- "重置"
|
||||
- "清空"
|
||||
|
||||
# 测试步骤 - 覆盖主要业务流程
|
||||
steps:
|
||||
# 1. 登录验证
|
||||
- action: goal
|
||||
goal: "在登录页面输入用户名admin和密码password,点击登录按钮"
|
||||
- action: wait
|
||||
duration: 2000
|
||||
- action: verify
|
||||
target: "成功登录并进入系统主页"
|
||||
|
||||
# 2. 测试主导航菜单
|
||||
- action: goal
|
||||
goal: "点击立项论证管理菜单"
|
||||
- action: wait
|
||||
duration: 1000
|
||||
- action: verify
|
||||
target: "成功进入立项论证管理页面"
|
||||
|
||||
# 3. 测试列表和详情
|
||||
- action: goal
|
||||
goal: "点击项目输入子菜单"
|
||||
- action: wait
|
||||
duration: 1000
|
||||
- action: goal
|
||||
goal: "点击1技术协议及科研合同评审记录"
|
||||
- action: verify
|
||||
target: "显示技术协议列表"
|
||||
|
||||
# 4. 测试表单功能
|
||||
- action: goal
|
||||
goal: "点击新增按钮"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 30 # 充分测试表单填写
|
||||
max_depth: 1
|
||||
- action: verify
|
||||
target: "表单成功提交并显示成功提示"
|
||||
|
||||
# 5. 测试产品方案管理
|
||||
- action: goal
|
||||
goal: "点击产品方案管理菜单"
|
||||
- action: wait
|
||||
duration: 1000
|
||||
- action: goal
|
||||
goal: "展开研制方案子菜单"
|
||||
- action: wait
|
||||
duration: 1000
|
||||
- action: goal
|
||||
goal: "点击研制方案菜单项"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 20
|
||||
max_depth: 2
|
||||
- action: verify
|
||||
target: "成功进入研制方案页面"
|
||||
|
||||
# 6. 测试其他管理模块
|
||||
- action: goal
|
||||
goal: "点击产品初样管理"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 15
|
||||
max_depth: 1
|
||||
- action: goal
|
||||
goal: "点击产品正样管理"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 15
|
||||
max_depth: 1
|
||||
- action: goal
|
||||
goal: "点击产品定型管理"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 15
|
||||
max_depth: 1
|
||||
|
||||
# 7. 测试系统管理功能
|
||||
- action: goal
|
||||
goal: "点击系统管理菜单"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 20
|
||||
max_depth: 2
|
||||
focus_patterns: ["用户", "角色", "权限", "日志"]
|
||||
|
||||
# 8. 测试待办事项和审批
|
||||
- action: goal
|
||||
goal: "点击待办事项"
|
||||
- action: wait
|
||||
duration: 1000
|
||||
- action: goal
|
||||
goal: "点击最新的待办记录"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 15
|
||||
max_depth: 1
|
||||
- action: verify
|
||||
target: "成功查看待办详情"
|
||||
|
||||
# 9. 测试搜索和筛选
|
||||
- action: goal
|
||||
goal: "在列表页面查找搜索框并输入测试内容"
|
||||
- action: explore
|
||||
config:
|
||||
max_clicks: 10
|
||||
max_depth: 1
|
||||
|
||||
# 10. 测试导出功能
|
||||
- action: goal
|
||||
goal: "查找并点击导出按钮(如果存在)"
|
||||
- action: wait
|
||||
duration: 2000
|
||||
|
||||
# 验证规则 - 确保功能正常
|
||||
verifications:
|
||||
# 登录成功验证
|
||||
- type: url_not_contains
|
||||
value: "/login"
|
||||
- type: text_contains
|
||||
value: "立项论证"
|
||||
|
||||
# 主要功能模块验证
|
||||
- type: element_exists
|
||||
value: ".ant-menu"
|
||||
- type: element_exists
|
||||
value: "button"
|
||||
- type: element_exists
|
||||
value: "input"
|
||||
|
||||
# 表单功能验证
|
||||
- type: element_exists
|
||||
value: "input[type='text']"
|
||||
- type: element_exists
|
||||
value: "input[type='password']"
|
||||
- type: element_exists
|
||||
value: "button:has-text('提交')"
|
||||
- type: element_exists
|
||||
value: "button:has-text('保存')"
|
||||
|
||||
# 列表功能验证
|
||||
- type: element_exists
|
||||
value: "table"
|
||||
- type: element_exists
|
||||
value: ".ant-table"
|
||||
|
||||
# 弹窗功能验证
|
||||
- type: element_exists
|
||||
value: ".ant-modal"
|
||||
- type: element_exists
|
||||
value: ".ant-drawer"
|
||||
23
tests/configs/github_example.json
Normal file
23
tests/configs/github_example.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "GitHub 探索测试",
|
||||
"url": "https://github.com",
|
||||
"mode": "explore",
|
||||
"model": "claude",
|
||||
"headless": true,
|
||||
"explore_config": {
|
||||
"max_depth": 10,
|
||||
"max_clicks": 50,
|
||||
"focus_patterns": ["repository", "code", "pull request", "issue"],
|
||||
"dangerous_patterns": ["delete", "remove", "sign out"]
|
||||
},
|
||||
"verifications": [
|
||||
{
|
||||
"type": "element_exists",
|
||||
"value": "header[role='banner']"
|
||||
},
|
||||
{
|
||||
"type": "text_contains",
|
||||
"value": "Where the world builds software"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
tests/configs/simple_test.yaml
Normal file
11
tests/configs/simple_test.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# 极简测试配置 - 适合未知系统
|
||||
name: 快速功能测试
|
||||
url: "http://47.99.105.253:8084"
|
||||
mode: explore # 只用探索模式,让AI自由发现
|
||||
|
||||
# 简单的探索配置
|
||||
explore_config:
|
||||
max_depth: 30 # 适中的深度
|
||||
max_clicks: 2000 # 快速测试
|
||||
# 不设置 focus_patterns,让AI自由发现
|
||||
dangerous_patterns: ["退出", "注销"] # 只避开危险操作
|
||||
32
tests/configs/smart_test.yaml
Normal file
32
tests/configs/smart_test.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
# 智能配置 - 自动适应登录状态
|
||||
name: 智能适应测试
|
||||
url: "http://47.99.105.253:8084"
|
||||
mode: hybrid
|
||||
model: glm
|
||||
|
||||
# 测试步骤 - 根据登录状态自动调整
|
||||
steps:
|
||||
# 步骤1: 显式登录逻辑
|
||||
- action: goal
|
||||
goal: "在用户名输入框中输入 admin,在密码输入框中输入 password,点击登录按钮"
|
||||
|
||||
# 步骤2: 确认进入首页
|
||||
- action: wait
|
||||
duration: 3000
|
||||
|
||||
# 步骤3: 深度探索后台功能
|
||||
- action: explore
|
||||
config:
|
||||
max_depth: 10
|
||||
max_clicks: 500
|
||||
# 引导 AI 关注您截图中显示的菜单
|
||||
focus_patterns: ["管理", "项目", "方案", "审核", "系统"]
|
||||
dangerous_patterns: ["退出", "注销", "删除"]
|
||||
auto_handle_login: false # 已经在第一步处理过了
|
||||
|
||||
# 验证规则 - 基础验证
|
||||
verifications:
|
||||
- type: url_not_contains
|
||||
value: "login"
|
||||
- type: text_contains
|
||||
value: "分析概览"
|
||||
Reference in New Issue
Block a user