Fix the verdict of sub test cases 12/67812/2
authorxudan <xudan16@huawei.com>
Thu, 9 May 2019 11:42:19 +0000 (07:42 -0400)
committerDan Xu <xudan16@huawei.com>
Thu, 16 May 2019 02:00:09 +0000 (02:00 +0000)
Error to group skipped sub test cases to passed one.
Example:
Skipped sub test case will be parsed as passed in following case.

skipped sub test case:
tempest.api.network.test_routers.RoutersTest.test_create_show_list_update_delete_router

passed sub test case list includes this one:
tempest.api.network.test_routers.RoutersTest.test_add_remove_router_interface_with_subnet_id

Then the skipped one will be checked as pass.

JIRA: DOVETAIL-775

Change-Id: I449f4968c23a9def1177a7c9645e5dcb89b2ec30
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/report.py
dovetail/tests/unit/test_report.py

index 09cfdce..65c4148 100644 (file)
@@ -597,7 +597,7 @@ class FunctestChecker(object):
             match = find_reg.findall(tc)
             if match:
                 return True
-        reg = sub_testcase.rsplit('.', 1)[0]
+        reg = sub_testcase.rsplit('.', 1)[0] + '$'
         find_reg = re.compile(reg)
         for tc in result:
             match = find_reg.findall(tc)
index 2dcb44e..4840f2b 100644 (file)
@@ -1382,8 +1382,15 @@ class ReportTesting(unittest.TestCase):
     def test_functest_get_sub_testcase_class_match(self):
         self.assertEquals(
             True,
-            dt_report.FunctestChecker.get_sub_testcase('subclass_a',
-                                                       ['subclass_a.subt_a',
+            dt_report.FunctestChecker.get_sub_testcase('subclass_a.subt_a',
+                                                       ['subclass_a',
+                                                        'subclass_b.subt_b']))
+
+    def test_functest_get_sub_testcase_class_no_match(self):
+        self.assertEquals(
+            False,
+            dt_report.FunctestChecker.get_sub_testcase('subclass_a.subt_a',
+                                                       ['subclass_a.subt_a_a',
                                                         'subclass_b.subt_b']))
 
     def test_functest_get_sub_no_match(self):