-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: #1142 extend the last one of the step in sub-testcase
- Loading branch information
1 parent
3f2ca42
commit 5534492
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
examples/postman_echo/request_methods/request_with_testcase_validate.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
config: | ||
name: "request methods testcase: reference testcase" | ||
variables: | ||
foo1: testsuite_config_bar1 | ||
expect_foo1: testsuite_config_bar1 | ||
expect_foo2: config_bar2 | ||
base_url: "https://postman-echo.com" | ||
verify: False | ||
|
||
teststeps: | ||
- | ||
name: "extend the last one of the step in sub-testcase" | ||
variables: | ||
foo1: testcase_ref_bar1 | ||
expect_foo1: testcase_ref_bar1 | ||
testcase: request_methods/request_with_functions.yml | ||
validate: | ||
- eq: ["status_code", 200] | ||
- eq: ["$foo3", "bar21"] # can access all extract-variables in sub-testcase |
49 changes: 49 additions & 0 deletions
49
examples/postman_echo/request_methods/request_with_testcase_validate_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# NOTE: Generated By HttpRunner v3.1.6 | ||
# FROM: request_methods/request_with_testcase_validate.yml | ||
|
||
|
||
import sys | ||
from pathlib import Path | ||
|
||
sys.path.insert(0, str(Path(__file__).parent.parent)) | ||
|
||
|
||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase | ||
|
||
from request_methods.request_with_functions_test import ( | ||
TestCaseRequestWithFunctions as RequestWithFunctions, | ||
) | ||
|
||
|
||
class TestCaseRequestWithTestcaseValidate(HttpRunner): | ||
|
||
config = ( | ||
Config("request methods testcase: reference testcase") | ||
.variables( | ||
**{ | ||
"foo1": "testsuite_config_bar1", | ||
"expect_foo1": "testsuite_config_bar1", | ||
"expect_foo2": "config_bar2", | ||
} | ||
) | ||
.base_url("https://postman-echo.com") | ||
.verify(False) | ||
) | ||
|
||
teststeps = [ | ||
Step( | ||
RunTestCase("extend the last one of the step in sub-testcase") | ||
.with_variables( | ||
**{"foo1": "testcase_ref_bar1", "expect_foo1": "testcase_ref_bar1"} | ||
) | ||
.call(RequestWithFunctions) | ||
.export(*["foo3"]) | ||
.validate() | ||
.assert_equal("status_code", 200) | ||
.assert_equal("$foo3", "bar21") | ||
), | ||
] | ||
|
||
|
||
if __name__ == "__main__": | ||
TestCaseRequestWithTestcaseValidate().test_start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters