covert notrun to ignored for the status of test report

This commit is contained in:
hwb0703 2021-04-02 15:04:50 +08:00
parent 32c6f81612
commit 941638ee91
2 changed files with 8 additions and 1 deletions

View File

@ -73,6 +73,7 @@ class ReportConstant:
blocked = "blocked" blocked = "blocked"
ignored = "ignored" ignored = "ignored"
unavailable = "unavailable" unavailable = "unavailable"
not_run = "notrun"
message = "message" message = "message"
# case result constants # case result constants
@ -401,7 +402,7 @@ class Case:
return self.status in [ReportConstant.unavailable] return self.status in [ReportConstant.unavailable]
def is_ignored(self): def is_ignored(self):
return self.status in [ReportConstant.skip] return self.status in [ReportConstant.skip, ReportConstant.not_run]
def get_result(self): def get_result(self):
if self.is_failed(): if self.is_failed():

View File

@ -164,6 +164,12 @@ class ResultReporter(IReporter):
ReportConstant.empty_name: ReportConstant.empty_name:
child.set(ReportConstant.module_name, module_name) child.set(ReportConstant.module_name, module_name)
self._check_tests_and_unavailable(child) self._check_tests_and_unavailable(child)
# covert "notrun" to "ignored" for the test case status
for element in child:
if element.get(ReportConstant.status, "") == \
ReportConstant.not_run:
ignored = int(child.get(ReportConstant.ignored, 0)) + 1
child.set(ReportConstant.ignored, "%s" % ignored)
test_suite_elements.append(child) test_suite_elements.append(child)
for update_attribute in need_update_attributes: for update_attribute in need_update_attributes:
update_value = child.get(update_attribute, 0) update_value = child.get(update_attribute, 0)