mirror of
https://github.com/httprunner/httprunner.py.git
synced 2026-07-12 16:03:28 +08:00
init: move from httprunner/httprunner
This commit is contained in:
36
examples/httpbin/hooks.yml
Normal file
36
examples/httpbin/hooks.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: ${get_httpbin_server()}
|
||||
setup_hooks:
|
||||
- ${hook_print(setup)}
|
||||
teardown_hooks:
|
||||
- ${hook_print(teardown)}
|
||||
|
||||
teststeps:
|
||||
-
|
||||
name: headers
|
||||
variables:
|
||||
a: 123
|
||||
request:
|
||||
url: /headers
|
||||
method: GET
|
||||
setup_hooks:
|
||||
- ${setup_hook_add_kwargs($request)}
|
||||
- ${setup_hook_remove_kwargs($request)}
|
||||
teardown_hooks:
|
||||
- ${teardown_hook_sleep_N_secs($response, 1)}
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- contained_by: [body.headers.Host, "${get_httpbin_server()}"]
|
||||
|
||||
-
|
||||
name: alter response
|
||||
request:
|
||||
url: /headers
|
||||
method: GET
|
||||
teardown_hooks:
|
||||
- ${alter_response($response)}
|
||||
validate:
|
||||
- eq: ["status_code", 500]
|
||||
- eq: [headers."Content-Type", "html/text"]
|
||||
- eq: [body.headers.Host, "127.0.0.1:8888"]
|
||||
Reference in New Issue
Block a user