diff options
author | hongbo tian <hongbo.tianhongbo@huawei.com> | 2016-11-09 07:16:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-09 07:16:29 +0000 |
commit | cd7b2cdaef7226165e511337858f10279652104d (patch) | |
tree | 2b34f2321e9252cf21dbe68a9bea7d3ffb898655 | |
parent | b79bf3c4748cb82bdc644efa078d11cff52e98ac (diff) | |
parent | 53fcd0928b67a57ed1025dd4cad3df50ea020642 (diff) |
Merge "dovetail tool: ensure sub_testcase_list and testcase are not None"
-rw-r--r-- | dovetail/report.py | 27 | ||||
-rwxr-xr-x | dovetail/run.py | 4 |
2 files changed, 22 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) diff --git a/dovetail/run.py b/dovetail/run.py index 39dec07c..310ef2aa 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -37,6 +37,10 @@ def run_test(scenario): for testcase_name in scenario['testcase_list']: logger.info('>>[testcase]: %s' % (testcase_name)) testcase = Testcase.get(testcase_name) + if testcase is None: + logger.error('testcase %s is not defined in testcase folder, \ + skipping' % (testcase_name)) + continue run_testcase = True if testcase.exceed_max_retry_times(): |