AIDeveloper-PC/gui_ai_developer/auto-test.txt

60 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

2026-03-04 18:09:45 +00:00
你现在是一名高级ai软件工程师非常擅长通过llm模型解决软件应用需求现在需要构建python工程利用ai实现基于api的自动化测试代码生成与执行支持将用户每个测试需求分解成对1个或多个接口的调用并基于接口返回描述对接口返回值进行测试设计如下
# 工作流程
1. 用户输入测试需求、接口描述文件文件采用json格式包含接口名称、请求参数描述、返回参数描述接口描述等信息。例如
## 接口描述示例
[
{
"name": "/api/create_user",
"description": "to create new user account in the system",
"protocol": "http",
"base_url": "http://123.0.0.1:8000"
"method": "post",
"url_parameters": {
"version": {
"type": "integer",
"description": "the api's version",
"required": "false"
}
},
"request_parameters": {
"username": { "type": "string", "description": "user name", "required": true },
"email": { "type": "string", "description": "the user's email", "required": false },
"password": { "type": "string", "description": "the user's password", "required": true }
},
"response": {
"code": {
"type": "integer",
"description": "0 is successful, nonzero is failure"
},
"user_id": {
"type": "integer",
"description": "the created user's id "
}
}
},
{
"name": "change_password",
"description": "replace old password with new password",
"protocol": "function",
"parameters": {
"user_id": { "type": "integer", "inout","in", "description": "the user's id", "required": true },
"old_password": { "type": "string", "inout","in", "description": "the old password", "required": true },
"new_password": { "type": "string", "inout","in", "description": "the user's new password", "required": true }
},
"return": {
"type": "integer",
"description": "0 is successful, nonzero is failure"
}
}
...
]
## 测试需求示例
1创建用户自动生成测试数据
2更改指定用户的密码自动生成测试数据支持先创建用户再改变该用户的密码
2. 软件将接口信息、指令、输出要求等通过提示词传递给llm模型。
3. llm模型结合用户测试需求并根据接口列表生成针对每个测试需求的测试用例包含生成的测试数据、代码等测试用例支持基于测试逻辑对多个接口的调用与返回值测试
4. 输出的测试用例以json格式返回。
5. 软件解析json数据并生成测试用例文件
6. 软件运行测试用例文件并输出每个测试用例的结果;