Files
httprunner/docs/data/demo-quickstart-4.json
2019-11-01 23:28:50 +08:00

70 lines
2.2 KiB
JSON

[
{
"config": {
"name": "testcase description",
"base_url": "http://127.0.0.1:5000",
"variables": {}
}
},
{
"test": {
"name": "/api/get-token",
"variables": {
"device_sn": "FwgRiO7CNA50DSU",
"os_platform": "ios",
"app_version": "2.8.6"
},
"request": {
"url": "/api/get-token",
"method": "POST",
"headers": {
"User-Agent": "python-requests/2.18.4",
"device_sn": "$device_sn",
"os_platform": "$os_platform",
"app_version": "$app_version",
"Content-Type": "application/json"
},
"json": {
"sign": "9c0c7e51c91ae963c833a4ccbab8d683c4a90c98"
}
},
"extract": [
{"token": "content.token"}
],
"validate": [
{"eq": ["status_code", 200]},
{"eq": ["headers.Content-Type", "application/json"]},
{"eq": ["content.success", true]}
]
}
},
{
"test": {
"name": "/api/users/$user_id",
"variables": {
"device_sn": "FwgRiO7CNA50DSU",
"user_id": "1000"
},
"request": {
"url": "/api/users/$user_id",
"method": "POST",
"headers": {
"User-Agent": "python-requests/2.18.4",
"device_sn": "$device_sn",
"token": "$token",
"Content-Type": "application/json"
},
"json": {
"name": "user1",
"password": "123456"
}
},
"validate": [
{"eq": ["status_code", 201]},
{"eq": ["headers.Content-Type", "application/json"]},
{"eq": ["content.success", true]},
{"eq": ["content.msg", "user created successfully."]}
]
}
}
]