mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
Merge pull request #856 from httprunner/leo_dev
2.5.6 **Fixed** - fix: abort test when failed to parse all cases - fix: log error when parse failed
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
# Release History
|
||||
|
||||
## 2.5.6 (2020-02-05)
|
||||
## 2.5.6 (2020-02-19)
|
||||
|
||||
**Added**
|
||||
|
||||
- feat: save variables and export data to JSON files when specified `--save-tests`
|
||||
- feat: save variables and export data to JSON files (named xx.io.json) when specified `--save-tests`
|
||||
|
||||
**Changed**
|
||||
|
||||
- change: alter HttpRunner default log_level to WARNING
|
||||
|
||||
**Fixed**
|
||||
|
||||
- fix: abort test when failed to parse all cases
|
||||
- fix: log error when parse failed
|
||||
|
||||
## 2.5.5 (2020-01-06)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class HttpRunner(object):
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, failfast=False, save_tests=False, log_level="INFO", log_file=None):
|
||||
def __init__(self, failfast=False, save_tests=False, log_level="WARNING", log_file=None):
|
||||
""" initialize HttpRunner.
|
||||
|
||||
Args:
|
||||
@@ -200,6 +200,10 @@ class HttpRunner(object):
|
||||
logger.log_warning("parse failures occurred ...")
|
||||
utils.dump_logs(parse_failed_testfiles, project_mapping, "parse_failed")
|
||||
|
||||
if len(parsed_testcases) == 0:
|
||||
logger.log_error("failed to parse all cases, abort.")
|
||||
raise exceptions.ParseTestsFailure
|
||||
|
||||
if self.save_tests:
|
||||
utils.dump_logs(parsed_testcases, project_mapping, "parsed")
|
||||
|
||||
@@ -223,7 +227,7 @@ class HttpRunner(object):
|
||||
utils.dump_logs(self._summary, project_mapping, "summary")
|
||||
# save variables and export data
|
||||
vars_out = self.get_vars_out()
|
||||
utils.dump_logs(vars_out, project_mapping, "vars_out")
|
||||
utils.dump_logs(vars_out, project_mapping, "io")
|
||||
|
||||
return self._summary
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ class MyBaseFailure(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ParseTestsFailure(MyBaseFailure):
|
||||
pass
|
||||
|
||||
|
||||
class ValidationFailure(MyBaseFailure):
|
||||
pass
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
from httprunner import __version__
|
||||
from httprunner import logger
|
||||
from httprunner.utils import init_sentry_sdk
|
||||
|
||||
@@ -104,6 +105,7 @@ def run_locusts_with_processes(sys_argv, processes_count):
|
||||
def main():
|
||||
""" Performance test with locust: parse command line options and run commands.
|
||||
"""
|
||||
print("HttpRunner version: {}".format(__version__))
|
||||
sys.argv[0] = 'locust'
|
||||
if len(sys.argv) == 1:
|
||||
sys.argv.extend(["-h"])
|
||||
|
||||
@@ -7,6 +7,7 @@ import json
|
||||
import re
|
||||
|
||||
from httprunner import exceptions, utils, loader
|
||||
from httprunner import logger
|
||||
from httprunner.compat import basestring, numeric_types, str
|
||||
|
||||
# use $$ to escape $ notation
|
||||
@@ -1242,10 +1243,12 @@ def _parse_testcase(testcase, project_mapping, session_variables_set=None):
|
||||
"config": prepared_config,
|
||||
"teststeps": prepared_testcase_tests
|
||||
}
|
||||
except (exceptions.MyBaseFailure, exceptions.MyBaseError):
|
||||
except (exceptions.MyBaseFailure, exceptions.MyBaseError) as ex:
|
||||
testcase_type = testcase["type"]
|
||||
testcase_path = testcase.get("path")
|
||||
|
||||
logger.log_error("failed to parse testcase: {}, error: {}".format(testcase_path, ex))
|
||||
|
||||
global parse_failed_testfiles
|
||||
if testcase_type not in parse_failed_testfiles:
|
||||
parse_failed_testfiles[testcase_type] = []
|
||||
|
||||
Reference in New Issue
Block a user