mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-15 04:19:28 +08:00
56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
# NOTE: Generated By HttpRunner v4.1.4
|
|
# FROM: postman/postman_collection_test.json
|
|
from httprunner import HttpRunner, Config, Step, RunRequest
|
|
|
|
|
|
class TestCasePostmanCollectionTest(HttpRunner):
|
|
|
|
config = Config("postman collection demo")
|
|
|
|
teststeps = [
|
|
Step(
|
|
RunRequest("folder1 - folder2 - Get with params")
|
|
.get("https://postman-echo.com/get")
|
|
.with_params(**{"k1": "v1", "k2": "v2"})
|
|
),
|
|
Step(
|
|
RunRequest("folder3 - Post form-data")
|
|
.post("https://postman-echo.com/post")
|
|
.upload(
|
|
**{
|
|
"intro_key": "intro.txt",
|
|
"k1": "v1",
|
|
"k2": "v2",
|
|
"logo_key": "logo.jpeg",
|
|
}
|
|
)
|
|
),
|
|
Step(
|
|
RunRequest("folder3 - Post x-www-form-urlencoded")
|
|
.post("https://postman-echo.com/post")
|
|
.with_headers(**{"Content-Type": "application/x-www-form-urlencoded"})
|
|
.with_data({"k1": "v1", "k2": "v2"})
|
|
),
|
|
Step(
|
|
RunRequest("folder3 - Post raw json")
|
|
.post("https://postman-echo.com/post")
|
|
.with_headers(**{"Content-Type": "application/json"})
|
|
.with_json({"k1": "v1", "k2": "v2"})
|
|
),
|
|
Step(
|
|
RunRequest("folder3 - Post raw text")
|
|
.post("https://postman-echo.com/post")
|
|
.with_headers(**{"Content-Type": "text/plain"})
|
|
.with_data("have a nice day")
|
|
),
|
|
Step(
|
|
RunRequest("Get request headers")
|
|
.get("https://postman-echo.com/headers")
|
|
.with_headers(**{"Connection": "close", "User-Agent": "HttpRunner"})
|
|
),
|
|
]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
TestCasePostmanCollectionTest().test_start()
|