change: add origin yaml/json testcase path in generated python testcases

This commit is contained in:
debugtalk
2020-05-17 11:08:36 +08:00
parent 4211f009c8
commit b3f478f63c
12 changed files with 14 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/httpbin/basic.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/httpbin/hooks.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/httpbin/load_image.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/httpbin/upload.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/httpbin/validate.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/hardcode.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/request_with_functions.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/request_with_testcase_reference.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/request_with_variables.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/validate_with_functions.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -1,4 +1,5 @@
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: examples/postman_echo/request_methods/validate_with_variables.yml
from httprunner import HttpRunner, TConfig, TStep

View File

@@ -10,6 +10,7 @@ from httprunner.exceptions import TestCaseFormatError
from httprunner.loader import load_testcase_file, load_folder_files
__TMPL__ = """# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
# FROM: {{ testcase_path }}
from httprunner import HttpRunner, TConfig, TStep
@@ -64,6 +65,7 @@ def make_testcase(testcase_path: str) -> Union[str, None]:
config = testcase["config"]
config["path"] = testcase_python_path
data = {
"testcase_path": testcase_path,
"class_name": f"TestCase{name_in_title_case}",
"config": config,
"teststeps": testcase["teststeps"],
@@ -120,7 +122,7 @@ def init_make_parser(subparsers):
""" make testcases: parse command line options and run commands.
"""
parser = subparsers.add_parser(
"make", help="Convert YAML/JSON testcases to Python unittests.",
"make", help="Convert YAML/JSON testcases to pytest cases.",
)
parser.add_argument(
"testcase_path", nargs="*", help="Specify YAML/JSON testcase file/folder path"