286 lines
6.0 KiB
JSON
286 lines
6.0 KiB
JSON
{
|
|
"name": "武术比赛报名系统API测试集合",
|
|
"description": "完整的API接口测试用例",
|
|
"baseUrl": "{{baseUrl}}",
|
|
"variables": {
|
|
"baseUrl": "http://your-api-domain.com",
|
|
"token": "",
|
|
"testCompetitionId": "",
|
|
"testAthleteId": "",
|
|
"testRegistrationId": ""
|
|
},
|
|
"testCases": [
|
|
{
|
|
"name": "1. 用户登录",
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/martial/auth/login",
|
|
"body": {
|
|
"username": "test_user",
|
|
"password": "test_password"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.code",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.data.token",
|
|
"saveAs": "token"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "2. 获取轮播图列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/banner/list",
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.code",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "3. 获取赛事列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/competition/list",
|
|
"params": {
|
|
"current": 1,
|
|
"size": 20
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.data.records[0].id",
|
|
"saveAs": "testCompetitionId"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "4. 获取赛事详情",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/competition/detail",
|
|
"params": {
|
|
"id": "{{testCompetitionId}}"
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.data.id",
|
|
"expected": "{{testCompetitionId}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "5. 获取选手列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/athlete/list",
|
|
"params": {
|
|
"current": 1,
|
|
"size": 100
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "6. 新增选手",
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/martial/athlete/submit",
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
},
|
|
"body": {
|
|
"name": "测试选手",
|
|
"idCard": "110101199001011234",
|
|
"team": "测试队伍",
|
|
"gender": "男",
|
|
"phone": "13800138000"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.data.id",
|
|
"saveAs": "testAthleteId"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "7. 获取报名项目列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/project/list",
|
|
"params": {
|
|
"competitionId": "{{testCompetitionId}}"
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "8. 提交报名",
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/martial/registration/submit",
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
},
|
|
"body": {
|
|
"competitionId": "{{testCompetitionId}}",
|
|
"projectIds": ["项目ID"],
|
|
"athleteIds": ["{{testAthleteId}}"],
|
|
"contactPhone": "13800138000",
|
|
"totalAmount": 100
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
},
|
|
{
|
|
"type": "jsonPath",
|
|
"path": "$.data.id",
|
|
"saveAs": "testRegistrationId"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "9. 获取我的报名列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/registration/list",
|
|
"params": {
|
|
"current": 1,
|
|
"size": 20
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "10. 获取成绩列表",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/result/list",
|
|
"params": {
|
|
"competitionId": "{{testCompetitionId}}",
|
|
"current": 1,
|
|
"size": 100
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "11. 获取奖牌榜",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/martial/medal/list",
|
|
"params": {
|
|
"competitionId": "{{testCompetitionId}}"
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "12. 删除选手(清理测试数据)",
|
|
"request": {
|
|
"method": "DELETE",
|
|
"url": "/martial/athlete/remove",
|
|
"params": {
|
|
"ids": "{{testAthleteId}}"
|
|
},
|
|
"headers": {
|
|
"Blade-Auth": "Bearer {{token}}"
|
|
}
|
|
},
|
|
"assertions": [
|
|
{
|
|
"type": "status",
|
|
"expected": 200
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|