fix: display validators in report when validate raised exception

This commit is contained in:
debugtalk
2019-12-25 23:21:10 +08:00
parent 8d2a212584
commit 4cd12e3d2f
4 changed files with 17 additions and 7 deletions

View File

@@ -1,5 +1,15 @@
# Release History
## 2.4.9 (2019-12-25)
**Added**
- test: add unittest for cli
**Fixed**
- fix: display validators in report when validate raised exception
## 2.4.8 (2019-12-25)
**Added**

View File

@@ -1,4 +1,4 @@
__version__ = "2.4.8"
__version__ = "2.4.9"
__description__ = "One-stop solution for HTTP(S) testing."
__all__ = ["__version__", "__description__"]

View File

@@ -303,8 +303,8 @@ class Runner(object):
except exceptions.ValidationFailure:
log_req_resp_details()
raise
return validator.validation_results
finally:
self.validation_results = validator.validation_results
def _run_testcase(self, testcase_dict):
""" run single testcase.
@@ -382,9 +382,9 @@ class Runner(object):
self._run_testcase(test_dict)
else:
# api
validation_results = {}
self.validation_results = {}
try:
validation_results = self._run_test(test_dict)
self._run_test(test_dict)
except Exception:
# log exception request_type and name for locust stat
self.exception_request_type = test_dict["request"]["method"]
@@ -393,7 +393,7 @@ class Runner(object):
finally:
# get request/response data and validate results
self.meta_datas = getattr(self.http_client_session, "meta_data", {})
self.meta_datas["validators"] = validation_results
self.meta_datas["validators"] = self.validation_results
def export_variables(self, output_variables_list):
""" export current testcase variables

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "httprunner"
version = "2.4.8"
version = "2.4.9"
description = "One-stop solution for HTTP(S) testing."
license = "Apache-2.0"
readme = "README.md"