mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-26 19:00:05 +08:00
Validate JSON testset format
This commit is contained in:
@@ -8,7 +8,7 @@ from httprunner import logger
|
||||
from httprunner.__about__ import __version__
|
||||
from httprunner.task import HttpRunner
|
||||
from httprunner.utils import (create_scaffold, load_dot_env_file, print_output,
|
||||
string_type)
|
||||
string_type, validate_json_file)
|
||||
|
||||
|
||||
def main_hrun():
|
||||
@@ -40,6 +40,9 @@ def main_hrun():
|
||||
parser.add_argument(
|
||||
'--startproject',
|
||||
help="Specify new project name.")
|
||||
parser.add_argument(
|
||||
'--validate', nargs='*',
|
||||
help="Validate JSON testset format.")
|
||||
|
||||
args = parser.parse_args()
|
||||
logger.setup_logger(args.log_level)
|
||||
@@ -48,6 +51,10 @@ def main_hrun():
|
||||
logger.color_print("{}".format(__version__), "GREEN")
|
||||
exit(0)
|
||||
|
||||
if args.validate:
|
||||
validate_json_file(args.validate)
|
||||
exit(0)
|
||||
|
||||
dot_env_path = args.dot_env_path or os.path.join(os.getcwd(), ".env")
|
||||
if dot_env_path:
|
||||
load_dot_env_file(dot_env_path)
|
||||
|
||||
Reference in New Issue
Block a user