Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化运行时长的显示 #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions BeautifulReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def stopTest(self, test) -> None:
当测试用力执行完成后进行调用
:return:
"""
self.end_time = '{0:.3} s'.format((time.time() - self.start_time))
test_time = time.time() - self.start_time
self.end_time = time.strftime("%H:%M:%S", time.gmtime(test_time))
self.result_list.append(self.get_all_result_info_tuple(test))
self.complete_output()

Expand Down Expand Up @@ -202,9 +203,11 @@ def stopTestRun(self, title=None) -> dict:
FIELDS['testName'] = title if title else self.default_report_name
FIELDS['testFail'] = self.failure_count
FIELDS['beginTime'] = self.begin_time
end_time = int(time.time())
start_time = int(time.mktime(time.strptime(self.begin_time, '%Y-%m-%d %H:%M:%S')))
FIELDS['totalTime'] = str(end_time - start_time) + 's'
end_time =time.time()
start_time = time.mktime(time.strptime(self.begin_time, '%Y-%m-%d %H:%M:%S'))
scend_time = end_time - start_time
all_time = time.strftime("%H:%M:%S", time.gmtime(scend_time))
FIELDS['totalTime'] = all_time
FIELDS['testError'] = self.error_count
FIELDS['testSkip'] = self.skipped
self.FIELDS = FIELDS
Expand Down