4
4
5
5
# Configuration
6
6
PROJECT_ID = 17
7
- # SUITE_NAMES = ["Bookmarks and History", "Drag and Drop", "Find Toolbar", "Audio/Video", " Downloads", "WebRTC "]
7
+ SUITE_NAMES = ["Downloads" ]
8
8
CUSTOM_SUB_TEST_SUITES = 1 # "Functional Only"
9
9
10
10
# Set TestRail credentials
@@ -44,7 +44,8 @@ def get_all_cases_from_suite(tr, project_id, suite_id):
44
44
45
45
# Get suite IDs for the selected suite names
46
46
suites = tr .get_suites (PROJECT_ID )
47
- suite_ids = [suite ["id" ] for suite in suites ]
47
+ # suite_ids = [suite["id"] for suite in suites]
48
+ suite_ids = [suite ["id" ] for suite in suites if suite ["name" ] in SUITE_NAMES ]
48
49
logging .info (f"Found suites: { suite_ids } " )
49
50
50
51
all_cases = []
@@ -55,6 +56,24 @@ def get_all_cases_from_suite(tr, project_id, suite_id):
55
56
logging .info (f"Total test cases found for selected suites: { len (all_cases )} " )
56
57
57
58
for case in all_cases :
58
- tr .update_case_field (case ["id" ], "custom_sub_tests_suites" , CUSTOM_SUB_TEST_SUITES )
59
+ result = tr .update_case_field (case ["id" ], "custom_sub_tests_suites" , CUSTOM_SUB_TEST_SUITES )
60
+ logging .debug (f"Updated case { case ['id' ]} result: { result } " )
59
61
60
62
logging .info ("All applicable test cases updated to 'Functional Only' successfully!" )
63
+
64
+ # Re-verify that all cases have been updated correctly
65
+ logging .info ("Verifying that all test cases were updated correctly..." )
66
+ failed_updates = []
67
+
68
+ for suite_id in suite_ids :
69
+ updated_cases = get_all_cases_from_suite (tr , PROJECT_ID , suite_id )
70
+ for case in updated_cases :
71
+ if case .get ("custom_sub_tests_suites" ) != CUSTOM_SUB_TEST_SUITES :
72
+ failed_updates .append (case ["id" ])
73
+
74
+ if failed_updates :
75
+ logging .warning (f"The following case IDs were not updated correctly: { failed_updates } " )
76
+ logging .warning (f"Number of failed updates: { len (failed_updates )} " )
77
+
78
+ else :
79
+ logging .info ("All test cases have the correct 'custom_sub_tests_suites' value." )
0 commit comments