mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-20 12:02:10 +08:00
add unit test and closes #971
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# NOTE: Generated By HttpRunner v3.1.3
|
||||
# FROM: request_methods/request_with_variables.yml
|
||||
# FROM: request_methods\request_with_variables.yml
|
||||
|
||||
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||
@@ -62,6 +62,25 @@ class TestCaseRequestWithVariables(HttpRunner):
|
||||
.assert_equal("body.form.foo2", "bar23")
|
||||
.assert_equal("body.form.foo3", "bar21")
|
||||
),
|
||||
Step(
|
||||
RunRequest("post form data using json")
|
||||
.with_variables(
|
||||
**{
|
||||
"foo2": "bar23",
|
||||
"jsondata": {"foo1": "$foo1", "foo2": "$foo2", "foo3": "$foo3"},
|
||||
}
|
||||
)
|
||||
.post("/post")
|
||||
.with_headers(
|
||||
**{"User-Agent": "HttpRunner/3.0", "Content-Type": "application/json"}
|
||||
)
|
||||
.with_json("$jsondata")
|
||||
.validate()
|
||||
.assert_equal("status_code", 200)
|
||||
.assert_equal("body.data.foo1", "testcase_config_bar1")
|
||||
.assert_equal("body.data.foo2", "bar23")
|
||||
.assert_equal("body.data.foo3", "bar21")
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user