mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
31 lines
857 B
Python
31 lines
857 B
Python
# NOTICE: Generated By HttpRunner.
|
|
# FROM: examples/httpbin/hooks.yml
|
|
|
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
|
|
|
|
|
class TestCaseHooks(HttpRunner):
|
|
config = Config("basic test with httpbin").base_url("${get_httpbin_server()}")
|
|
|
|
teststeps = [
|
|
Step(
|
|
RunRequest("headers")
|
|
.with_variables(**{"a": 123})
|
|
.get("/headers")
|
|
.validate()
|
|
.assert_equal("status_code", 200)
|
|
.assert_contained_by("body.headers.Host", "${get_httpbin_server()}")
|
|
),
|
|
Step(
|
|
RunRequest("alter response")
|
|
.get("/headers")
|
|
.validate()
|
|
.assert_equal("status_code", 200)
|
|
.assert_equal("body.headers.Host", "httpbin.org")
|
|
),
|
|
]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
TestCaseHooks().test_start()
|