[Bugfix] Local summary with wrong results when Tempest failed at the SetupClass 81/48781/5
authorxudan <xudan16@huawei.com>
Wed, 13 Dec 2017 07:00:34 +0000 (02:00 -0500)
committerLeo wang <grakiss.wanglei@huawei.com>
Mon, 25 Dec 2017 01:22:40 +0000 (01:22 +0000)
When Tempest test cases failed at the SetupClass, the record is the class name
of the test cases rather than the name of the test cases.
The local summary will say they are passed wrongly.

JIRA: DOVETAIL-575

Change-Id: Iec879378770017eddd37e9a99346d980355bb6e2
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/report.py

index 12d6dca..39326b9 100644 (file)
@@ -274,10 +274,12 @@ class FunctestCrawler(object):
                         if complex_testcase:
                             tests = data['details']['tests']
                             failed_num = data['details']['failures']
+                            success_case = data['details']['success']
                             error_case = data['details']['errors']
                             skipped_case = data['details']['skipped']
                             details = {"tests": tests,
                                        "failures": failed_num,
+                                       "success": success_case,
                                        "errors": error_case,
                                        "skipped": skipped_case}
                 except KeyError as e:
@@ -456,6 +458,13 @@ class FunctestChecker(object):
 
     @staticmethod
     def get_sub_testcase(sub_testcase, result):
+        # This adaption is because of the danube bug of Functest.
+        # Has been fixed in Euphrates.
+        # Patch link https://gerrit.opnfv.org/gerrit/#/c/47897/
+        if sub_testcase == "tempest.api.identity.v3.test_tokens." \
+            "TokensV3Test.test_create_token":
+            sub_testcase = "tempest.api.identity.v3.test_t"
+
         if not result:
             return False
         sub_testcase = re.sub("\[.*?\]", "", sub_testcase)
@@ -487,30 +496,24 @@ class FunctestChecker(object):
         if sub_testcase_list is None:
             return
 
-        testcase_passed = 'SKIP'
+        testcase_passed = 'PASS'
         for sub_testcase in sub_testcase_list:
             self.logger.debug('Check sub_testcase: {}'.format(sub_testcase))
             try:
                 if self.get_sub_testcase(sub_testcase,
-                                         db_result['details']['errors']):
-                    testcase.sub_testcase_passed(sub_testcase, 'FAIL')
-                    testcase_passed = 'FAIL'
+                                         db_result['details']['success']):
+                    testcase.sub_testcase_passed(sub_testcase, 'PASS')
                     continue
                 if self.get_sub_testcase(sub_testcase,
                                          db_result['details']['skipped']):
                     testcase.sub_testcase_passed(sub_testcase, 'SKIP')
                 else:
-                    testcase.sub_testcase_passed(sub_testcase, 'PASS')
+                    testcase.sub_testcase_passed(sub_testcase, 'FAIL')
+                testcase_passed = 'FAIL'
             except KeyError:
                 testcase.sub_testcase_passed(sub_testcase, 'FAIL')
                 testcase_passed = 'FAIL'
 
-        if testcase_passed == 'SKIP':
-            for sub_testcase in sub_testcase_list:
-                if testcase.sub_testcase_status[sub_testcase] == 'PASS':
-                    testcase_passed = 'PASS'
-                    break
-
         testcase.passed(testcase_passed)