show log even if test failed

This commit is contained in:
httprunner
2018-11-28 17:52:37 +08:00
parent 84fd49eeeb
commit 5e7db08470
2 changed files with 15 additions and 6 deletions
+5
View File
@@ -235,12 +235,17 @@ def __expand_meta_datas(meta_datas, meta_datas_expanded):
def __get_total_response_time(meta_datas_expanded): def __get_total_response_time(meta_datas_expanded):
""" caculate total response time of all meta_datas """ caculate total response time of all meta_datas
""" """
try:
response_time = 0 response_time = 0
for meta_data in meta_datas_expanded: for meta_data in meta_datas_expanded:
response_time += meta_data["response"]["response_time_ms"] response_time += meta_data["response"]["response_time_ms"]
return "{:.2f}".format(response_time) return "{:.2f}".format(response_time)
except TypeError:
# failure exists
return "N/A"
def __stringify_meta_datas(meta_datas): def __stringify_meta_datas(meta_datas):
+4
View File
@@ -318,7 +318,11 @@ class Runner(object):
self.meta_datas = self._run_testcase(test_dict) self.meta_datas = self._run_testcase(test_dict)
else: else:
# api # api
try:
self._run_test(test_dict) self._run_test(test_dict)
except Exception:
raise
finally:
self.meta_datas = self.__get_test_data() self.meta_datas = self.__get_test_data()
def extract_sessions(self): def extract_sessions(self):