summaryrefslogtreecommitdiffstats
path: root/dovetail/report.py
diff options
context:
space:
mode:
authorzshi <zshi@redhat.com>2016-11-03 16:46:19 +0800
committerzshi <zshi@redhat.com>2016-11-08 10:05:38 +0800
commit53fcd0928b67a57ed1025dd4cad3df50ea020642 (patch)
tree68fd1eba71f5237629bb50c7880bab36180ae627 /dovetail/report.py
parent976d8e0640e478c79002f402bbe9996955c02629 (diff)
dovetail tool: ensure sub_testcase_list and testcase are not None
JIRA: DOVETAIL-52 1) save return value of testcase.sub_testcase() in sub_testcase_list for multiple calls later 2) ensure sub_testcase_list is not called with None value 3) ensure testcase is not called with None value 4) identify None testcase with 'Undefined' in dovetail_report.txt Change-Id: Ifcf0c0846dc788575310f29932a4757752f1e3a3 Signed-off-by: zshi <zshi@redhat.com>
Diffstat (limited to 'dovetail/report.py')
-rw-r--r--dovetail/report.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/dovetail/report.py b/dovetail/report.py
index 9ea90231..eae8d180 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -38,14 +38,21 @@ class Report:
@classmethod
def generate(cls, scenario_yaml):
report = ''
+ split_line = '+-----------------------------------------------------'
+ split_line += '---------------------+\n'
report += '\n\
+==========================================================================+\n\
-| report |\n\
-+--------------------------------------------------------------------------+\n'
+| report |\n'
+ report += split_line
report += '|scenario: %s\n' % scenario_yaml['name']
for testcase_name in scenario_yaml['testcase_list']:
testcase = Testcase.get(testcase_name)
+ if testcase is None:
+ report += '| [testcase]: %s\t\t\t\t[Undefined]\n' % \
+ (testcase_name)
+ report += split_line
+ continue
report += '| [testcase]: %s\t\t\t\t[%s]\n' % \
(testcase_name, get_pass_str(testcase.passed()))
report += '| |-objective: %s\n' % testcase.objective()
@@ -54,8 +61,7 @@ class Report:
report += '| |-%s \t\t [%s]\n' % \
(subtest,
get_pass_str(testcase.sub_testcase_passed(subtest)))
- report += '+-----------------------------------------------------'
- report += '---------------------+\n'
+ report += split_line
logger.info(report)
cls.save(report)
@@ -224,23 +230,26 @@ class ResultChecker:
class FunctestChecker:
def check(cls, testcase, db_result):
+ sub_testcase_list = testcase.sub_testcase()
+
if not db_result:
- for sub_testcase in testcase.sub_testcase():
- testcase.sub_testcase_passed(sub_testcase, False)
+ if sub_testcase_list is not None:
+ for sub_testcase in sub_testcase_list:
+ testcase.sub_testcase_passed(sub_testcase, False)
return
testcase.passed(db_result['criteria'] == 'PASS')
- if testcase.sub_testcase() is None:
+ if sub_testcase_list is None:
return
if testcase.testcase['passed'] is True:
- for sub_testcase in testcase.sub_testcase():
+ for sub_testcase in sub_testcase_list:
testcase.sub_testcase_passed(sub_testcase, True)
return
all_passed = True
- for sub_testcase in testcase.sub_testcase():
+ for sub_testcase in sub_testcase_list:
logger.debug('check sub_testcase:%s' % sub_testcase)
if sub_testcase in db_result['details']['errors']:
testcase.sub_testcase_passed(sub_testcase, False)