mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: save extracted variables to session variables
This commit is contained in:
@@ -57,7 +57,7 @@ class TestCaseRequestWithFunctions(HttpRunner):
|
|||||||
.assert_equal("status_code", 200)
|
.assert_equal("status_code", 200)
|
||||||
.assert_equal(
|
.assert_equal(
|
||||||
"body.data",
|
"body.data",
|
||||||
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar21.",
|
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32.",
|
||||||
)
|
)
|
||||||
.assert_type_match("body.json", "None")
|
.assert_type_match("body.json", "None")
|
||||||
.assert_type_match("body.json", "NoneType")
|
.assert_type_match("body.json", "NoneType")
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ teststeps:
|
|||||||
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
|
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
|
||||||
validate:
|
validate:
|
||||||
- eq: ["status_code", 200]
|
- eq: ["status_code", 200]
|
||||||
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar21."]
|
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32."]
|
||||||
- type_match: ["body.json", None]
|
- type_match: ["body.json", None]
|
||||||
- type_match: ["body.json", NoneType]
|
- type_match: ["body.json", NoneType]
|
||||||
- type_match: ["body.json", null]
|
- type_match: ["body.json", null]
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class TestCaseRequestWithFunctions(HttpRunner):
|
|||||||
.assert_equal("status_code", 200)
|
.assert_equal("status_code", 200)
|
||||||
.assert_equal(
|
.assert_equal(
|
||||||
"body.data",
|
"body.data",
|
||||||
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar21.",
|
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32.",
|
||||||
)
|
)
|
||||||
.assert_type_match("body.json", "None")
|
.assert_type_match("body.json", "None")
|
||||||
.assert_type_match("body.json", "NoneType")
|
.assert_type_match("body.json", "NoneType")
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ teststeps:
|
|||||||
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
|
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
|
||||||
validate:
|
validate:
|
||||||
- eq: ["status_code", 200]
|
- eq: ["status_code", 200]
|
||||||
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-testcase_config_bar2-bar21."]
|
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-testcase_config_bar2-bar32."]
|
||||||
-
|
-
|
||||||
name: post form data
|
name: post form data
|
||||||
variables:
|
variables:
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class TestCaseRequestWithVariables(HttpRunner):
|
|||||||
.assert_equal("status_code", 200)
|
.assert_equal("status_code", 200)
|
||||||
.assert_equal(
|
.assert_equal(
|
||||||
"body.data",
|
"body.data",
|
||||||
"This is expected to be sent back as part of response body: bar12-testcase_config_bar2-bar21.",
|
"This is expected to be sent back as part of response body: bar12-testcase_config_bar2-bar32.",
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Step(
|
Step(
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ class HttpRunner(object):
|
|||||||
# save extracted variables to session variables
|
# save extracted variables to session variables
|
||||||
extracted_variables.update(extract_mapping)
|
extracted_variables.update(extract_mapping)
|
||||||
|
|
||||||
self.__session_variables.update(extract_mapping)
|
self.__session_variables.update(extracted_variables)
|
||||||
self.__duration = time.time() - self.__start_at
|
self.__duration = time.time() - self.__start_at
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user