#52: validator expect field support reference variable

This commit is contained in:
debugtalk
2017-12-13 01:22:43 +08:00
parent cd89157fa6
commit 3f3b0f1ea7
2 changed files with 7 additions and 2 deletions

View File

@@ -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,

View File

@@ -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]