mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 22:39:42 +08:00
feat: implement upload keyword
This commit is contained in:
43
examples/httpbin/validate_test.py
Normal file
43
examples/httpbin/validate_test.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
||||
from httprunner import HttpRunner, TConfig, TStep
|
||||
|
||||
|
||||
class TestCaseValidate(HttpRunner):
|
||||
config = TConfig(
|
||||
**{
|
||||
"name": "basic test with httpbin",
|
||||
"base_url": "http://httpbin.org/",
|
||||
"path": "examples/httpbin/validate_test.py",
|
||||
}
|
||||
)
|
||||
|
||||
teststeps = [
|
||||
TStep(
|
||||
**{
|
||||
"name": "validate response with json path",
|
||||
"request": {"url": "/get", "params": {"a": 1, "b": 2}, "method": "GET"},
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"eq": ["body.args.a", 1]},
|
||||
{"eq": ["body.args.b", 2]},
|
||||
],
|
||||
"validate_script": ["assert status_code == 200"],
|
||||
}
|
||||
),
|
||||
TStep(
|
||||
**{
|
||||
"name": "validate response with python script",
|
||||
"request": {"url": "/get", "params": {"a": 1, "b": 2}, "method": "GET"},
|
||||
"validate": [{"eq": ["status_code", 200]}],
|
||||
"validate_script": [
|
||||
"assert status_code == 201",
|
||||
"a = response_json.get('args').get('a')",
|
||||
"assert a == '1'",
|
||||
],
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TestCaseValidate().test_start()
|
||||
Reference in New Issue
Block a user