mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-25 10:20:11 +08:00
new feature: testcases can be layered, now we can define interface in api block individually
This commit is contained in:
40
tests/data/demo_testset_layer.yml
Normal file
40
tests/data/demo_testset_layer.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
- config:
|
||||
name: "create user testsets."
|
||||
variable_binds:
|
||||
- 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
|
||||
|
||||
- test:
|
||||
name: get token
|
||||
api: get_token($user_agent, $device_sn, $os_platform, $app_version)
|
||||
extract_binds:
|
||||
- token: content.token
|
||||
|
||||
- test:
|
||||
name: create user which does not exist
|
||||
variable_binds:
|
||||
- uid: 1000
|
||||
- user_name: "user1"
|
||||
- user_password: "123456"
|
||||
api: create_user($uid, $user_name, $user_password, $token)
|
||||
validators:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 201}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": true}
|
||||
|
||||
- test:
|
||||
name: create user which does not exist
|
||||
variable_binds:
|
||||
- uid: 1000
|
||||
- user_name: "user1"
|
||||
- user_password: "123456"
|
||||
api: create_user($uid, $user_name, $user_password, $token)
|
||||
validators:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 500}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": false}
|
||||
Reference in New Issue
Block a user