mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-25 02:10:24 +08:00
feat: make pytest files in chain style
This commit is contained in:
54
examples/postman_echo/cookie_manipulation/hardcode_test.py
Normal file
54
examples/postman_echo/cookie_manipulation/hardcode_test.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
|
||||
# FROM: examples/postman_echo/cookie_manipulation/hardcode.yml
|
||||
from httprunner import HttpRunner, TConfig, TStep
|
||||
|
||||
|
||||
class TestCaseHardcode(HttpRunner):
|
||||
config = TConfig(
|
||||
**{
|
||||
"name": "set & delete cookies.",
|
||||
"base_url": "https://postman-echo.com",
|
||||
"verify": False,
|
||||
"export": ["cookie_foo1", "cookie_foo3"],
|
||||
"path": "examples/postman_echo/cookie_manipulation/hardcode_test.py",
|
||||
}
|
||||
)
|
||||
|
||||
teststeps = [
|
||||
TStep(
|
||||
**{
|
||||
"name": "set cookie foo1 & foo2 & foo3",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "/cookies/set",
|
||||
"params": {"foo1": "bar1", "foo2": "bar2"},
|
||||
"headers": {"User-Agent": "HttpRunner/${get_httprunner_version()}"},
|
||||
},
|
||||
"extract": {"cookie_foo1": "$.cookies.foo1"},
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"eq": ["cookies.foo1", "bar1"]},
|
||||
],
|
||||
}
|
||||
),
|
||||
TStep(
|
||||
**{
|
||||
"name": "delete cookie foo2",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "/cookies/delete?foo2",
|
||||
"headers": {"User-Agent": "HttpRunner/${get_httprunner_version()}"},
|
||||
},
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"ne": ["$.cookies.foo1", "$foo1"]},
|
||||
{"eq": ["$.cookies.foo1", "$cookie_foo1"]},
|
||||
{"eq": ["$.cookies.foo3", "$cookie_foo3"]},
|
||||
],
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TestCaseHardcode().test_start()
|
||||
Reference in New Issue
Block a user