def end_test(): ''' Run test cases. Random or repeat test cases. First, lead test suit list. Second,repeat case 1~x x is be defined on Settings config.Third, random test case if you choose on Settings config. ''' import logging_wrapper #end track and export track as KML end_current_track_and_export_kml(get_log_root()) #move the crash to the current log dir move_crash() clear_status() #back to auto test after end set_can_continue() launcher = Launcher() launcher.launch_from_launcher('auto_test') end_test_runners_accessibility() log_root = logging_wrapper.log_root if os.path.exists(log_root): log_status = log_root + os.sep + "log_status.qsst" logging_wrapper.__write_log(SERVICE_END_TIME + DIVIDE + get_file_timestring(), log_status) enableTouchPanel() if SC.PRIVATE_HOSTLOGGING_ENABLE_FEATURE: quit_qxdm()
def OnStopSignal_handler(a, b): ''' something jobs when click stop button to kill python. ''' log_test_framework(TAG, "stop qsst-----") #end track and export track as KML end_current_track_and_export_kml(get_log_root()) #record exit time in current suit qsst. qsst_log_path = logging_wrapper.qsst_log_path if os.path.exists(qsst_log_path): logging_wrapper.__write_log( PREFIX_END_TIME + DIVIDE + get_timestring(), qsst_log_path) #record exit time in current repeat time qsst. if (logging_wrapper.get_logging_filepath()).split(os.sep)[-2].isdigit(): logging_wrapper.__write_log( "SUITS_END_TIME" + DIVIDE + get_file_timestring(), logging_wrapper.get_logging_filepath() + "log_status_" + str(TestCaseBase.cycle_index) + ".qsst") #record exit time in log_status.qsst log_root = logging_wrapper.log_root if os.path.exists(log_root): log_status = log_root + os.sep + "log_status.qsst" logging_wrapper.__write_log( SERVICE_END_TIME + DIVIDE + get_file_timestring(), log_status) #exit sys.exit()
if suit_list != None and len(suit_list) > 0: #report suits count log_test_framework( TAG, "All test suites (" + str(len(suit_list)) + ") :") # run all test suits suit_results = [] for suit in suit_list: log_test_framework(TAG, "Suit : " + suit.name) try: suit.test_suit_run(suit_results) except Exception as e: log_test_framework(TAG, "Error :" + str(e)) log_test_framework( TAG, "Traceback :" + traceback.format_exc()) if SC.PUBLIC_CHOOSE_INTERACTIVE_CASE_MODE == 'interactive_case_on_the_forward' or SC.PUBLIC_CHOOSE_INTERACTIVE_CASE_MODE == 'interactive_case_on_the_last': runInteractiveCase() except Exception as e: log_test_framework(TAG, "Error :" + str(e)) log_test_framework(TAG, "Traceback :" + traceback.format_exc()) log_test_framework("test_main", "\n all suit finished.") if (logging_wrapper.get_logging_filepath()).split( os.sep)[-2].isdigit(): logging_wrapper.__write_log( "SUITS_END_TIME" + DIVIDE + get_file_timestring(), logging_wrapper.get_logging_filepath() + "log_status_" + str(current_number) + ".qsst") # end_test()