mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
81 lines
2.5 KiB
Python
81 lines
2.5 KiB
Python
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
|
|
# FROM: examples/postman_echo/request_methods/hardcode.yml
|
|
|
|
from httprunner import HttpRunner, TConfig, TStep
|
|
|
|
|
|
class TestCaseHardcode(HttpRunner):
|
|
config = TConfig(
|
|
**{
|
|
"name": "request methods testcase in hardcode",
|
|
"base_url": "https://postman-echo.com",
|
|
"verify": False,
|
|
"path": "examples/postman_echo/request_methods/hardcode_test.py",
|
|
"variables": {},
|
|
}
|
|
)
|
|
|
|
teststeps = [
|
|
TStep(
|
|
**{
|
|
"name": "get with params",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/get",
|
|
"params": {"foo1": "bar1", "foo2": "bar2"},
|
|
"headers": {"User-Agent": "HttpRunner/3.0"},
|
|
},
|
|
"validate": [{"eq": ["status_code", 200]}],
|
|
}
|
|
),
|
|
TStep(
|
|
**{
|
|
"name": "post raw text",
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/post",
|
|
"headers": {
|
|
"User-Agent": "HttpRunner/3.0",
|
|
"Content-Type": "text/plain",
|
|
},
|
|
"data": "This is expected to be sent back as part of response body.",
|
|
},
|
|
"validate": [{"eq": ["status_code", 200]}],
|
|
}
|
|
),
|
|
TStep(
|
|
**{
|
|
"name": "post form data",
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/post",
|
|
"headers": {
|
|
"User-Agent": "HttpRunner/3.0",
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
},
|
|
"data": "foo1=bar1&foo2=bar2",
|
|
},
|
|
"validate": [{"eq": ["status_code", 200]}],
|
|
}
|
|
),
|
|
TStep(
|
|
**{
|
|
"name": "put request",
|
|
"request": {
|
|
"method": "PUT",
|
|
"url": "/put",
|
|
"headers": {
|
|
"User-Agent": "HttpRunner/3.0",
|
|
"Content-Type": "text/plain",
|
|
},
|
|
"data": "This is expected to be sent back as part of response body.",
|
|
},
|
|
"validate": [{"eq": ["status_code", 200]}],
|
|
}
|
|
),
|
|
]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
TestCaseHardcode().test_start()
|