其实做到现在,大家知道为什么我给了2个demo讲述json管理用例吗?
你写完会发现很头疼,没办法直观感受到用例设计的快乐。
为了拼接而拼接。就跟我去设计用例的时候,要设计json文件,简单点的像登录还好说:
{
"url": "/login",
"method": "GET",
"headers":
{"Content-Type":"application/x-www-form-urlencoded"},
"casedata":
[
[{"caseNo": "01"},{"caseName": "正常登录"},{"reqParam": {"username":"admin","password":"123456"}}],
[{"caseNo": "02"},{"caseName": "登录-用户名错误"},{"reqParam": {"username":"admin111","password":"123456"}}],
[{"caseNo": "03"},{"caseName": "登录-密码错误"},{"reqParam": {"username":"admin","password":"123456111"}}]
]
}
一旦长起来的的,比如下面的这个添加线索:
{"url": "/CrmLeads/addOrUpdate", "method": "POST", "headers": {"Content-Type": "application/json", "Admin-Token": "44669243e3ff4151a37456913a6b7ec1"}, "casedata": [[{"entity": {"leads_name": "\u6536\u5230\u5c31\u597d2", "telephone": "15991710522", "mobile": "15991710522", "address": "111", "next_time": "2024-01-08 00:00:00", "remark": "11111111"}, "field": [{"fieldId": 2, "formType": "select", "isNull": 0, "name": "\u7ebf\u7d22\u6765\u6e90", "options": "\u4fc3\u9500,\u641c\u7d22\u5f15\u64ce,\u5e7f\u544a,\u8f6c\u4ecb\u7ecd,\u7ebf\u4e0a\u6ce8\u518c,\u7ebf\u4e0a\u8be2\u4ef7,\u9884\u7ea6\u4e0a\u95e8,\u7535\u8bdd\u54a8\u8be2,\u90ae\u4ef6\u54a8\u8be2", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u641c\u7d22\u5f15\u64ce", "fieldType": 0, "fieldName": "\u7ebf\u7d22\u6765\u6e90", "setting": ["\u4fc3\u9500", "\u641c\u7d22\u5f15\u64ce", "\u5e7f\u544a", "\u8f6c\u4ecb\u7ecd", "\u7ebf\u4e0a\u6ce8\u518c", "\u7ebf\u4e0a\u8be2\u4ef7", "\u9884\u7ea6\u4e0a\u95e8", "\u7535\u8bdd\u54a8\u8be2", "\u90ae\u4ef6\u54a8\u8be2"]}, {"fieldId": 5, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u884c\u4e1a", "options": "IT,\u91d1\u878d\u4e1a,\u623f\u5730\u4ea7,\u5546\u4e1a\u670d\u52a1,\u8fd0\u8f93/\u7269\u6d41,\u751f\u4ea7,\u653f\u5e9c,\u6587\u5316\u4f20\u5a92", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u623f\u5730\u4ea7", "fieldType": 0, "fieldName": "\u5ba2\u6237\u884c\u4e1a", "setting": ["IT", "\u91d1\u878d\u4e1a", "\u623f\u5730\u4ea7", "\u5546\u4e1a\u670d\u52a1", "\u8fd0\u8f93/\u7269\u6d41", "\u751f\u4ea7", "\u653f\u5e9c", "\u6587\u5316\u4f20\u5a92"]}, {"fieldId": 6, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u7ea7\u522b", "options": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09,B\uff08\u666e\u901a\u5ba2\u6237\uff09,C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09", "isUnique": 0, "inputTips": "null", "type": 3, "value": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "fieldType": 0, "fieldName": "\u5ba2\u6237\u7ea7\u522b", "setting": ["A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "B\uff08\u666e\u901a\u5ba2\u6237\uff09", "C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09"]}]}], [{"entity": {"leads_name": "\u6536\u5230\u5c31\u597d2", "telephone": "15991710522", "mobile": "15991710522", "address": "111", "next_time": "2024-01-08 00:00:00", "remark": "11111111"}, "field": [{"fieldId": 2, "formType": "select", "isNull": 0, "name": "\u7ebf\u7d22\u6765\u6e90", "options": "\u4fc3\u9500,\u641c\u7d22\u5f15\u64ce,\u5e7f\u544a,\u8f6c\u4ecb\u7ecd,\u7ebf\u4e0a\u6ce8\u518c,\u7ebf\u4e0a\u8be2\u4ef7,\u9884\u7ea6\u4e0a\u95e8,\u7535\u8bdd\u54a8\u8be2,\u90ae\u4ef6\u54a8\u8be2", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u641c\u7d22\u5f15\u64ce", "fieldType": 0, "fieldName": "\u7ebf\u7d22\u6765\u6e90", "setting": ["\u4fc3\u9500", "\u641c\u7d22\u5f15\u64ce", "\u5e7f\u544a", "\u8f6c\u4ecb\u7ecd", "\u7ebf\u4e0a\u6ce8\u518c", "\u7ebf\u4e0a\u8be2\u4ef7", "\u9884\u7ea6\u4e0a\u95e8", "\u7535\u8bdd\u54a8\u8be2", "\u90ae\u4ef6\u54a8\u8be2"]}, {"fieldId": 5, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u884c\u4e1a", "options": "IT,\u91d1\u878d\u4e1a,\u623f\u5730\u4ea7,\u5546\u4e1a\u670d\u52a1,\u8fd0\u8f93/\u7269\u6d41,\u751f\u4ea7,\u653f\u5e9c,\u6587\u5316\u4f20\u5a92", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u623f\u5730\u4ea7", "fieldType": 0, "fieldName": "\u5ba2\u6237\u884c\u4e1a", "setting": ["IT", "\u91d1\u878d\u4e1a", "\u623f\u5730\u4ea7", "\u5546\u4e1a\u670d\u52a1", "\u8fd0\u8f93/\u7269\u6d41", "\u751f\u4ea7", "\u653f\u5e9c", "\u6587\u5316\u4f20\u5a92"]}, {"fieldId": 6, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u7ea7\u522b", "options": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09,B\uff08\u666e\u901a\u5ba2\u6237\uff09,C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09", "isUnique": 0, "inputTips": "null", "type": 3, "value": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "fieldType": 0, "fieldName": "\u5ba2\u6237\u7ea7\u522b", "setting": ["A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "B\uff08\u666e\u901a\u5ba2\u6237\uff09", "C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09"]}]}], [{"entity": {"leads_name": "\u6536\u5230\u5c31\u597d2", "telephone": "15991710522", "mobile": "15991710522", "address": "111", "next_time": "2024-01-08 00:00:00", "remark": "11111111"}, "field": [{"fieldId": 2, "formType": "select", "isNull": 0, "name": "\u7ebf\u7d22\u6765\u6e90", "options": "\u4fc3\u9500,\u641c\u7d22\u5f15\u64ce,\u5e7f\u544a,\u8f6c\u4ecb\u7ecd,\u7ebf\u4e0a\u6ce8\u518c,\u7ebf\u4e0a\u8be2\u4ef7,\u9884\u7ea6\u4e0a\u95e8,\u7535\u8bdd\u54a8\u8be2,\u90ae\u4ef6\u54a8\u8be2", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u641c\u7d22\u5f15\u64ce", "fieldType": 0, "fieldName": "\u7ebf\u7d22\u6765\u6e90", "setting": ["\u4fc3\u9500", "\u641c\u7d22\u5f15\u64ce", "\u5e7f\u544a", "\u8f6c\u4ecb\u7ecd", "\u7ebf\u4e0a\u6ce8\u518c", "\u7ebf\u4e0a\u8be2\u4ef7", "\u9884\u7ea6\u4e0a\u95e8", "\u7535\u8bdd\u54a8\u8be2", "\u90ae\u4ef6\u54a8\u8be2"]}, {"fieldId": 5, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u884c\u4e1a", "options": "IT,\u91d1\u878d\u4e1a,\u623f\u5730\u4ea7,\u5546\u4e1a\u670d\u52a1,\u8fd0\u8f93/\u7269\u6d41,\u751f\u4ea7,\u653f\u5e9c,\u6587\u5316\u4f20\u5a92", "isUnique": 0, "inputTips": "null", "type": 3, "value": "\u623f\u5730\u4ea7", "fieldType": 0, "fieldName": "\u5ba2\u6237\u884c\u4e1a", "setting": ["IT", "\u91d1\u878d\u4e1a", "\u623f\u5730\u4ea7", "\u5546\u4e1a\u670d\u52a1", "\u8fd0\u8f93/\u7269\u6d41", "\u751f\u4ea7", "\u653f\u5e9c", "\u6587\u5316\u4f20\u5a92"]}, {"fieldId": 6, "formType": "select", "isNull": 0, "name": "\u5ba2\u6237\u7ea7\u522b", "options": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09,B\uff08\u666e\u901a\u5ba2\u6237\uff09,C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09", "isUnique": 0, "inputTips": "null", "type": 3, "value": "A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "fieldType": 0, "fieldName": "\u5ba2\u6237\u7ea7\u522b", "setting": ["A\uff08\u91cd\u70b9\u5ba2\u6237\uff09", "B\uff08\u666e\u901a\u5ba2\u6237\uff09", "C\uff08\u975e\u4f18\u5148\u5ba2\u6237\uff09"]}]}]]}
你看着头大不?
我看着都操心,本来写代码是一个很好的事情,结果变成一件很糟心的事情
由此,我想了想为什么先不从用例模板开始思考
这是不是就很nice了,看着也明晰,很多功能测试人员也好更新