mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
support both "validate" and "validators"
This commit is contained in:
@@ -267,7 +267,7 @@ class Runner(object):
|
||||
self.session_context.update_session_variables(extracted_variables_mapping)
|
||||
|
||||
# validate
|
||||
validators = test_dict.get("validate", [])
|
||||
validators = test_dict.get("validate") or test_dict.get("validators") or []
|
||||
try:
|
||||
self.session_context.validate(validators, resp_obj)
|
||||
except (exceptions.ParamsError, exceptions.ValidationFailure, exceptions.ExtractFailure):
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
request:
|
||||
url: /image/png
|
||||
method: GET
|
||||
validators:
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
@@ -15,7 +15,7 @@
|
||||
request:
|
||||
url: /image/jpeg
|
||||
method: GET
|
||||
validators:
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
@@ -23,7 +23,7 @@
|
||||
request:
|
||||
url: /image/webp
|
||||
method: GET
|
||||
validators:
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
@@ -31,6 +31,6 @@
|
||||
request:
|
||||
url: /image/svg
|
||||
method: GET
|
||||
validators:
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user