mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-08 07:51:25 +08:00
refactor: add extract_binds and validators
This commit is contained in:
@@ -8,13 +8,14 @@
|
||||
json:
|
||||
name: user1
|
||||
password: 123456
|
||||
response:
|
||||
status_code: 201
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
body:
|
||||
success: true
|
||||
msg: user created successfully.
|
||||
extract_binds:
|
||||
resp_status_code: status_code
|
||||
resp_body_success: content.success
|
||||
resp_headers_content_type: headers.content-type
|
||||
validators:
|
||||
resp_status_code: {"comparator": "eq", "expected": 201}
|
||||
resp_headers_content_type: {"comparator": "eq", "expected": "application/json"}
|
||||
resp_body_success: {"comparator": "eq", "expected": true}
|
||||
|
||||
- test:
|
||||
name: create user which existed
|
||||
@@ -26,10 +27,11 @@
|
||||
json:
|
||||
name: user1
|
||||
password: 123456
|
||||
response:
|
||||
status_code: 500
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
body:
|
||||
success: false
|
||||
msg: user already existed.
|
||||
extract_binds:
|
||||
resp_status_code: status_code
|
||||
resp_body_success: content.success
|
||||
resp_headers_content_type: headers.content-type
|
||||
validators:
|
||||
resp_status_code: {"comparator": "eq", "expected": 500}
|
||||
resp_headers_content_type: {"comparator": "eq", "expected": "application/json"}
|
||||
resp_body_success: {"comparator": "eq", "expected": false}
|
||||
Reference in New Issue
Block a user