show log even if test failed

This commit is contained in:
debugtalk
2018-11-28 17:52:37 +08:00
parent 173594a201
commit a1785c5542
2 changed files with 15 additions and 6 deletions

View File

@@ -235,11 +235,16 @@ 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
""" """
response_time = 0 try:
for meta_data in meta_datas_expanded: response_time = 0
response_time += meta_data["response"]["response_time_ms"] for meta_data in meta_datas_expanded:
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):

View File

@@ -318,8 +318,12 @@ class Runner(object):
self.meta_datas = self._run_testcase(test_dict) self.meta_datas = self._run_testcase(test_dict)
else: else:
# api # api
self._run_test(test_dict) try:
self.meta_datas = self.__get_test_data() self._run_test(test_dict)
except Exception:
raise
finally:
self.meta_datas = self.__get_test_data()
def extract_sessions(self): def extract_sessions(self):
""" """