mirror of
https://github.com/httprunner/httprunner.py.git
synced 2026-05-31 21:19:32 +08:00
init: move from httprunner/httprunner
This commit is contained in:
34
examples/data/a_b_c/T1_test.py
Normal file
34
examples/data/a_b_c/T1_test.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: a-b.c/1.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
class TestCaseT1(HttpRunner):
|
||||
|
||||
config = (
|
||||
Config("request methods testcase with functions")
|
||||
.variables(**{"foo1": "config_bar1", "foo2": "config_bar2"})
|
||||
.base_url("https://postman-echo.com")
|
||||
.verify(False)
|
||||
)
|
||||
|
||||
teststeps = [
|
||||
Step(
|
||||
RunRequest("get with params")
|
||||
.with_variables(**{"foo1": "bar1", "sum_v": "${sum_two(1, 2)}"})
|
||||
.get("/get")
|
||||
.with_params(**{"foo1": "$foo1", "foo2": "$foo2", "sum_v": "$sum_v"})
|
||||
.with_headers(**{"User-Agent": "HttpRunner/${get_httprunner_version()}"})
|
||||
.extract()
|
||||
.with_jmespath("body.args.foo2", "session_foo2")
|
||||
.validate()
|
||||
.assert_equal("status_code", 200)
|
||||
.assert_equal("body.args.foo1", "bar1")
|
||||
.assert_equal("body.args.sum_v", "3")
|
||||
.assert_equal("body.args.foo2", "config_bar2")
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TestCaseT1().test_start()
|
||||
44
examples/data/a_b_c/T2_3_test.py
Normal file
44
examples/data/a_b_c/T2_3_test.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: a-b.c/2 3.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
from httprunner import RunTestCase
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from a_b_c.T1_test import TestCaseT1 as T1
|
||||
|
||||
|
||||
class TestCaseT23(HttpRunner):
|
||||
|
||||
config = (
|
||||
Config("reference testcase unittest for abnormal folder path")
|
||||
.base_url("https://postman-echo.com")
|
||||
.verify(False)
|
||||
)
|
||||
|
||||
teststeps = [
|
||||
Step(RunTestCase("request with functions").call(T1).export(*["session_foo2"])),
|
||||
Step(
|
||||
RunRequest("post form data")
|
||||
.with_variables(**{"foo1": "bar12"})
|
||||
.post("/post")
|
||||
.with_headers(
|
||||
**{
|
||||
"User-Agent": "HttpRunner/${get_httprunner_version()}",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
)
|
||||
.with_data("foo1=$foo1&foo2=$session_foo2")
|
||||
.validate()
|
||||
.assert_equal("status_code", 200)
|
||||
.assert_equal("body.form.foo1", "bar12")
|
||||
.assert_equal("body.form.foo2", "config_bar2")
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TestCaseT23().test_start()
|
||||
1
examples/data/a_b_c/__init__.py
Normal file
1
examples/data/a_b_c/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
|
||||
Reference in New Issue
Block a user