mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
update tests for custom validator
This commit is contained in:
@@ -16,17 +16,23 @@
|
||||
"sign": "f1219719911caae89ccc301679857ebfda115ca2"
|
||||
}
|
||||
},
|
||||
"variables": [
|
||||
{"expect_status_code": 200},
|
||||
{"token_len": 16}
|
||||
],
|
||||
"extract": [
|
||||
{
|
||||
"token": "content.token"
|
||||
}
|
||||
],
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"len_eq": ["content.token", 16]},
|
||||
{"check": "status_code", "comparator": "eq", "expect": 200},
|
||||
{"sum_status_code": ["status_code", 2]},
|
||||
{"check": "content.token", "comparator": "len_eq", "expect": 16}
|
||||
{"eq": ["status_code", "$expect_status_code"]},
|
||||
{"check": "$token", "comparator": "len_eq", "expect": 16},
|
||||
{"len_eq": ["$token", "$token_len"]},
|
||||
{"len_eq": ["content.token", 16]},
|
||||
{"check": "status_code", "comparator": "sum_status_code", "expect": 2},
|
||||
{"sum_status_code": ["status_code", 2]}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
extract:
|
||||
- token: content.token
|
||||
validate:
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 200}
|
||||
- eq: ["status_code", $expect_status_code]
|
||||
- {"check": "$token", "comparator": "len_eq", "expect": 16}
|
||||
- len_eq: ["$token", $token_len]
|
||||
- len_eq: ["content.token", 16]
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 200}
|
||||
- {"check": "status_code", "comparator": "sum_status_code", "expect": 2}
|
||||
- sum_status_code: ["status_code", 2]
|
||||
- {"check": "$token", "comparator": "len_eq", "expect": 16}
|
||||
|
||||
- test:
|
||||
name: create user which does not exist
|
||||
|
||||
Reference in New Issue
Block a user