mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
#52: validator expect field support reference variable
This commit is contained in:
@@ -230,6 +230,8 @@ class Context(object):
|
||||
except exception.ParseResponseError:
|
||||
raise exception.ParseResponseError("failed to extract check item in response!")
|
||||
|
||||
expect_value = self.testcase_parser.eval_content_variables(expect_value)
|
||||
|
||||
validator_dict = {
|
||||
"check_item": check_item,
|
||||
"check_value": check_value,
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
app_version: '2.8.6'
|
||||
json:
|
||||
sign: f1219719911caae89ccc301679857ebfda115ca2
|
||||
variables:
|
||||
- expect_status_code: 200
|
||||
- token_len: 16
|
||||
extract:
|
||||
- token: content.token
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- len_eq: ["$token", 16]
|
||||
- eq: ["status_code", $expect_status_code]
|
||||
- len_eq: ["$token", $token_len]
|
||||
- len_eq: ["content.token", 16]
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 200}
|
||||
- sum_status_code: ["status_code", 2]
|
||||
|
||||
Reference in New Issue
Block a user