This commit is contained in:
debugtalk
2018-08-30 16:21:33 +08:00
5 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
__title__ = 'HttpRunner'
__description__ = 'One-stop solution for HTTP(S) testing.'
__url__ = 'https://github.com/HttpRunner/HttpRunner'
__version__ = '1.5.11'
__version__ = '1.5.12'
__author__ = 'debugtalk'
__author_email__ = 'mail@debugtalk.com'
__license__ = 'MIT'

View File

@@ -230,6 +230,7 @@ class Context(object):
logger.log_info("start to validate.")
validate_pass = True
failures = []
for validator in validators:
# evaluate validators with context variable mapping.
@@ -240,12 +241,14 @@ class Context(object):
try:
self._do_validation(evaluated_validator)
except exceptions.ValidationFailure:
except exceptions.ValidationFailure as ex:
validate_pass = False
failures.append(str(ex))
evaluated_validators.append(evaluated_validator)
if not validate_pass:
raise exceptions.ValidationFailure
failures_string = "\n".join([failure for failure in failures])
raise exceptions.ValidationFailure(failures_string)
return evaluated_validators

View File

@@ -214,8 +214,7 @@ class Runner(object):
# validate
try:
self.evaluated_validators = self.context.validate(validators, resp_obj)
except (exceptions.ParamsError, \
exceptions.ValidationFailure, exceptions.ExtractFailure):
except (exceptions.ParamsError, exceptions.ValidationFailure, exceptions.ExtractFailure):
# log request
err_req_msg = "request: \n"
err_req_msg += "headers: {}\n".format(parsed_request.pop("headers", {}))

View File

@@ -263,7 +263,7 @@ def add_teststep(test_runner, teststep_dict):
try:
test_runner.run_test(teststep_dict)
except exceptions.MyBaseFailure as ex:
self.fail(repr(ex))
self.fail(str(ex))
finally:
if hasattr(test_runner.http_client_session, "meta_data"):
self.meta_data = test_runner.http_client_session.meta_data

3
tests/data/test.env Normal file
View File

@@ -0,0 +1,3 @@
UserName=test
Password=654321
PROJECT_KEY=AAABBBCCC