mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
119 lines
3.4 KiB
YAML
119 lines
3.4 KiB
YAML
- config:
|
|
name: "user management testset."
|
|
variables:
|
|
- user_agent: 'iOS/10.3'
|
|
- device_sn: ${gen_random_string(15)}
|
|
- os_platform: 'ios'
|
|
- app_version: '2.8.6'
|
|
request:
|
|
base_url: $BASE_URL
|
|
headers:
|
|
Content-Type: application/json
|
|
device_sn: $device_sn
|
|
output:
|
|
- token
|
|
|
|
- test:
|
|
name: get token
|
|
api: get_token($user_agent, $device_sn, $os_platform, $app_version)
|
|
extract:
|
|
- token: content.token
|
|
|
|
- test:
|
|
name: reset all users
|
|
api: reset_all($token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.success", "expected": true}
|
|
|
|
- test:
|
|
name: get user that does not exist
|
|
api: get_user(1000, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 404}
|
|
- {"check": "content.success", "expected": false}
|
|
|
|
- test:
|
|
name: create user which does not exist
|
|
variables:
|
|
- user_name: "user1"
|
|
- user_password: "123456"
|
|
api: create_user(1000, $user_name, $user_password, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 201}
|
|
- {"check": "content.success", "expected": true}
|
|
|
|
- test:
|
|
name: get user that has been created
|
|
api: get_user(1000, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.success", "expected": true}
|
|
- {"check": "content.data.password", "expected": "123456"}
|
|
|
|
- test:
|
|
name: create user which exists
|
|
variables:
|
|
- user_name: "user1"
|
|
- user_password: "123456"
|
|
api: create_user(1000, $user_name, $user_password, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 500}
|
|
- {"check": "content.success", "expected": false}
|
|
|
|
- test:
|
|
name: update user which exists
|
|
variables:
|
|
- user_name: "user1"
|
|
- user_password: "654321"
|
|
api: update_user(1000, $user_name, $user_password, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.success", "expected": true}
|
|
|
|
- test:
|
|
name: get user that has been updated
|
|
api: get_user(1000, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.success", "expected": true}
|
|
- {"check": "content.data.password", "expected": "654321"}
|
|
|
|
- test:
|
|
name: get users
|
|
api: get_users($token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.count", "expected": 1}
|
|
|
|
- test:
|
|
name: delete user that exists
|
|
api: delete_user(1000, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.success", "expected": true}
|
|
|
|
- test:
|
|
name: get users
|
|
api: get_users($token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.count", "expected": 0}
|
|
|
|
- test:
|
|
name: create user which has been deleted
|
|
variables:
|
|
- user_name: "user1"
|
|
- user_password: "123456"
|
|
api: create_user(1000, $user_name, $user_password, $token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 201}
|
|
- {"check": "content.success", "expected": true}
|
|
|
|
- test:
|
|
name: get users
|
|
api: get_users($token)
|
|
validators:
|
|
- {"check": "status_code", "expected": 200}
|
|
- {"check": "content.count", "expected": 1}
|