@@ -699,10 +699,10 @@ def run_all_test_steps_in_a_test_case(
699699def calculate_test_case_result (sModuleInfo , TestCaseID , run_id , sTestStepResultList , testcase_info ):
700700 if "BLOCKED" in sTestStepResultList :
701701 CommonUtil .ExecLog (sModuleInfo , "Test Case Blocked" , 3 )
702- sTestCaseStatus = "Blocked"
702+ return "Blocked"
703703 elif "CANCELLED" in sTestStepResultList or "Cancelled" in sTestStepResultList :
704704 CommonUtil .ExecLog (sModuleInfo , "Test Case Cancelled" , 3 )
705- sTestCaseStatus = "Cancelled"
705+ return "Cancelled"
706706 elif "zeuz_failed" .upper () in sTestStepResultList :
707707 step_index = 0
708708 for each in sTestStepResultList :
@@ -714,24 +714,23 @@ def calculate_test_case_result(sModuleInfo, TestCaseID, run_id, sTestStepResultL
714714 else :
715715 sTestCaseStatus = "Blocked"
716716 CommonUtil .ExecLog (sModuleInfo , "Test Case " + sTestCaseStatus , 3 )
717+ return sTestCaseStatus
717718
718719 elif "WARNING" in sTestStepResultList :
719720 CommonUtil .ExecLog (sModuleInfo , "Test Case Contain Warning(s)" , 2 )
720- sTestCaseStatus = "Failed"
721+ return "Failed"
721722 elif "NOT RUN" in sTestStepResultList :
722723 CommonUtil .ExecLog (sModuleInfo , "Test Case Contain Not Run Steps" , 2 )
723- sTestCaseStatus = "Failed"
724- elif "SKIPPED" in sTestStepResultList :
725- sTestCaseStatus = "Skipped"
724+ return "Failed"
725+ elif all ([i == "SKIPPED" for i in sTestStepResultList ]):
726726 CommonUtil .ExecLog (sModuleInfo , "Test Case Skipped" , 1 )
727+ return "Skipped"
727728 elif "PASSED" in sTestStepResultList :
728729 CommonUtil .ExecLog (sModuleInfo , "Test Case Passed" , 1 )
729- sTestCaseStatus = "Passed"
730+ return "Passed"
730731 else :
731732 CommonUtil .ExecLog (sModuleInfo , "Test Case Status Unknown" , 2 )
732- sTestCaseStatus = "Unknown"
733-
734- return sTestCaseStatus
733+ return "Unknown"
735734
736735
737736# writes the log file for a test case
@@ -1007,8 +1006,9 @@ def run_test_case(
10071006 if performance and browserDriver :
10081007 shared .Set_Shared_Variables ("selenium_driver" , browserDriver )
10091008
1009+ sTestCaseStatus = None
10101010 if check_test_skip (run_id , tc_num ):
1011- sTestStepResultList = ['SKIPPED' ]
1011+ sTestStepResultList = ['SKIPPED' for i in range ( len ( testcase_info [ 'steps' ])) ]
10121012 else :
10131013 sTestStepResultList = run_all_test_steps_in_a_test_case (
10141014 testcase_info ,
@@ -1023,9 +1023,8 @@ def run_test_case(
10231023 performance
10241024 )
10251025 if check_test_skip (run_id , tc_num , False ):
1026- sTestStepResultList [- 1 ] = 'SKIPPED'
1027-
1028- # TODO: Test case run is completed here somewhere.
1026+ CommonUtil .ExecLog (sModuleInfo , "Test Case Skipped" , 1 )
1027+ sTestCaseStatus = 'Skipped'
10291028
10301029 ConfigModule .add_config_value (
10311030 "sectionOne" ,
@@ -1039,7 +1038,8 @@ def run_test_case(
10391038 sTestCaseEndTime = datetime .fromtimestamp (TestCaseEndTime , tz = pytz .UTC ).strftime ("%Y-%m-%d %H:%M:%S" )
10401039
10411040 # Decide if Test Case Pass/Failed
1042- sTestCaseStatus = calculate_test_case_result (sModuleInfo , test_case , run_id , sTestStepResultList , testcase_info )
1041+ if sTestCaseStatus is None :
1042+ sTestCaseStatus = calculate_test_case_result (sModuleInfo , test_case , run_id , sTestStepResultList , testcase_info )
10431043
10441044 #Writing error information in a text file
10451045 if sTestCaseStatus == "Failed" or sTestCaseStatus == "Blocked" :
0 commit comments