def test_suit_init(self, suit_results):
        '''
        init the test suit . such as: save the current suit name; init the report logging; launcher this application;
        set the L{current_case_continue_flag<current_case_continue_flag>} to True;
        '''
        set_cur_suit_name(self.name)
        log_test_framework(self.name, "suit init...")
        qsst_log_suit_init()
        set_can_continue()
        suit_config_map = fs_wrapper.get_test_suit_config(self.name)
        global suit_description
        suit_description = suit_config_map.get(fs_wrapper.SUIT_DESCRIPTION)
        if suit_description == None:
            suit_description = ''

        import settings.common as SC
        #if auto insert case waypoint.
        if SC.PRIVATE_TRACKING_AUTO_INSERT_CASE_WAYPOINT:
            if int(SC.PUBLIC_RUNNING_REPEAT_NUMBER) == 1:
                insert_waypoint(START_RUN + self.name, suit_description)
            else:
                insert_waypoint(
                    START_RUN + '(' + str(TestCaseBase.cycle_index) + '/' +
                    str(SC.PUBLIC_RUNNING_REPEAT_NUMBER) + ') ' + self.name,
                    suit_description)
        return True
Esempio n. 2
0
def call(suit_name, case_name, config_file_name='all_suit_config'):
    log_test_framework(LOG_TAG, "begin call ... ")
    suit_names = fs_wrapper.get_suit_name_list("./")
    test_config_map = fs_wrapper.get_test_config(config_file_name)
    for suit in suit_names:
        if suit == suit_name:
            #continue
            suit_py_module_name = fs_wrapper.get_suit_py_module_name(suit_name)
            if len(suit_py_module_name) == 0:
                continue
            # load the suit config
            suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
            #check the suit whether is enable
            #if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) != '1':
            #    log_test_framework(LOG_TAG, "the suit is disable")
            #    return
            #create the suit//suit_module_name + fs_wrapper.DOT_TAG + suit_name
            suit_info = test_config_map.get(suit_name)
            test_suit = createInstance(
                suit_py_module_name + fs_wrapper.DOT_TAG + suit_name,
                suit_name, suit_info)
            if suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR) != None:
                test_suit.runner = suit_config_map.get(
                    fs_wrapper.SUIT_RUNNER_ATTR)
            if suit_config_map.get(fs_wrapper.SUIT_APP_NAME) != None:
                app_name = suit_config_map.get(fs_wrapper.SUIT_APP_NAME)
            # load test cases for test suit.
            # It will aggregate all the relative suit info for this test suit, too.
            case_names = fs_wrapper.get_all_cases_py_module_name(
                test_suit.name)
            for case in case_names:
                case_config_map = fs_wrapper.get_test_case_config(
                    case[1], test_suit.name)
                case_app_name = case_config_map.get(fs_wrapper.CASE_APP_NAME)
                if case_app_name == None or case_app_name == "":
                    case_app_name = app_name
                #if case_config_map.get(fs_wrapper.CASE_ENABLE_ATTR) == '1':
                test_case = createInstance(
                    case[0] + fs_wrapper.DOT_TAG + case[1], case[1], suit_name,
                    case_app_name)
                test_case.case_config_map = case_config_map
                test_case.original_ClassName = ''
                test_case.runReason = CASE_BE_CALLED
                test_suit.addCase(test_case)
            case_results = []
            for case in test_suit.test_cases:
                if case_name == "" or case.name == case_name:
                    set_ignore_status(True)
                    #save the current case name
                    pre_case_name = get_cur_case_name()
                    success = case.test_case_run(case_results)
                    #checkout the current case name
                    set_cur_case_name(pre_case_name)
                    set_ignore_status(False)
                    if success == None:
                        return True
                    return success
            log_test_framework(LOG_TAG,
                               "can not find the case name:" + case_name)
            return False
Esempio n. 3
0
    def loadTestSuitFromName(self, suit_module_name, suit_name):
        '''
        load test suit from name

        @type suit_module_name: string
        @param suit_module_name: suit module name
        @type suit_name: string
        @param suit_name: suit name
        @return: return the suit instance
        '''
        suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
        if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) != '1':
            return None
        suit_info = None

        # create test suit instance
        test_suit = TestSuitBase.createInstance(suit_module_name + fs_wrapper.DOT_TAG + suit_name, suit_name, suit_info)
        if suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR) != None:
            test_suit.runner = suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR)
        if suit_config_map.get(fs_wrapper.SUIT_APP_NAME) != None:
            app_name =  suit_config_map.get(fs_wrapper.SUIT_APP_NAME)


        # load test cases for test suit.
        # It will aggregate all the relative suit info for this test suit, too.
        cases = fs_wrapper.get_all_cases_py_module_name(test_suit.name)
        #relative_suits = []
        status = 0
        if is_suit_in_reboot_status(suit_name) and is_in_reboot_status():
            status = 1
        log_test_framework(TAG, "suit_name:"+suit_name)
        for case in cases:
            log_test_framework(TAG, "check case:"+case[1])
            if status == 1 and not is_case_in_reboot_status(case[1]):
                log_test_framework(TAG,  "status == 1 and not is_case_in_reboot_status")
                continue
            elif status == 1 and is_case_in_reboot_status(case[1]):
                log_test_framework(TAG,  "status == 1 and is_case_in_reboot_status")
                status = 2
                if get_reboot_reason() == REBOOT_CRASH:
                    log_test_framework(TAG,  "get_reboot_reason() == REBOOT_CRASH")
                    qsst_log_restore_reboot()
                    continue
                qsst_log_restore_reboot()
            log_test_framework(TAG,  "add case:"+case[1])
            case_config_map = fs_wrapper.get_test_case_config(case[1], test_suit.name)
            if case_config_map.get(fs_wrapper.CASE_ENABLE_ATTR) == '1':
                case_app_name = case_config_map.get(fs_wrapper.CASE_APP_NAME)
                if case_app_name == None or case_app_name == "":
                    case_app_name = app_name
                else:
                    log_test_framework(TAG,'case_app_name null')
                reference = case_config_map.get(fs_wrapper.CASE_REFERENCE);
                if reference != None and reference!= "":
                    (suit_name, case_name) = reference.rsplit('.', 1)
                    class_name = reference + fs_wrapper.DOT_TAG + case_name
                    self.addTestCase(test_suit,case_config_map,class_name, suit_name,case_name, case_app_name)
                else:
                    self.addTestCase(test_suit,case_config_map,case[0] + fs_wrapper.DOT_TAG + case[1], suit_name,case[1], case_app_name)
        return test_suit
Esempio n. 4
0
    def getUnInteractiveCaseList(self, base_path):
        '''
        load the test cases from the path

        @type base_path: string
        @param base_path: the path of the case
        @return: return all the cases which can found under this path
        '''
        all_case_name_list = []
        suit_name_list = fs_wrapper.get_suit_name_list(base_path)
        for suit_name in suit_name_list:
            suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
            if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) == '1':
                cases = fs_wrapper.get_all_cases_py_module_name(suit_name)
                for case in cases:
                    case_config_map = fs_wrapper.get_test_case_config(
                        case[1], suit_name)
                    if case_config_map.get(fs_wrapper.CASE_ENABLE_ATTR) == '1':
                        if case_config_map.get(
                                fs_wrapper.CASE_INTERACTIVE_ATTR
                        ) != '1' or case_config_map.get(
                                fs_wrapper.CASE_INTERACTIVE_ATTR) == '':
                            all_case_name_list.append(
                                (suit_name + fs_wrapper.DOT_TAG + case[1],
                                 case[1]))
        return all_case_name_list
Esempio n. 5
0
    def loadTestSuitFromName(self, suit_module_name, suit_name):
        '''
        load test suit from name

        @type suit_module_name: string
        @param suit_module_name: suit module name
        @type suit_name: string
        @param suit_name: suit name
        @return: return the suit instance
        '''
        suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
        if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) != '1':
            return None
        suit_info = None

        # create test suit instance
        test_suit = TestSuitBase.createInstance(
            suit_module_name + fs_wrapper.DOT_TAG + suit_name, suit_name,
            suit_info)
        if suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR) != None:
            test_suit.runner = suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR)
        if suit_config_map.get(fs_wrapper.SUIT_APP_NAME) != None:
            app_name = suit_config_map.get(fs_wrapper.SUIT_APP_NAME)

        # load test cases for test suit.
        # It will aggregate all the relative suit info for this test suit, too.
        cases = fs_wrapper.get_all_cases_py_module_name(test_suit.name)
        #relative_suits = []
        status = 0
        if is_suit_in_reboot_status(suit_name) and is_in_reboot_status():
            status = 1
        log_test_framework(TAG, "suit_name:" + suit_name)
        for case in cases:
            log_test_framework(TAG, "check case:" + case[1])
            if status == 1 and not is_case_in_reboot_status(case[1]):
                log_test_framework(
                    TAG, "status == 1 and not is_case_in_reboot_status")
                continue
            elif status == 1 and is_case_in_reboot_status(case[1]):
                log_test_framework(TAG,
                                   "status == 1 and is_case_in_reboot_status")
                status = 2
                if get_reboot_reason() == REBOOT_CRASH:
                    log_test_framework(TAG,
                                       "get_reboot_reason() == REBOOT_CRASH")
                    qsst_log_restore_reboot()
                    continue
Esempio n. 6
0
def call(suit_name,case_name,config_file_name='all_suit_config'):
    log_test_framework(LOG_TAG,  "begin call ... ")
    suit_names = fs_wrapper.get_suit_name_list("./")
    test_config_map = fs_wrapper.get_test_config(config_file_name)
    for suit in suit_names:
        if suit ==suit_name:
            #continue
            suit_py_module_name = fs_wrapper.get_suit_py_module_name(suit_name)
            if len(suit_py_module_name) == 0:
                continue
            # load the suit config
            suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
            #check the suit whether is enable
            #if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) != '1':
            #    log_test_framework(LOG_TAG, "the suit is disable")
            #    return
            #create the suit//suit_module_name + fs_wrapper.DOT_TAG + suit_name
            suit_info = test_config_map.get(suit_name)
            test_suit = createInstance(suit_py_module_name + fs_wrapper.DOT_TAG + suit_name, suit_name,suit_info)
            if suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR) != None:
                test_suit.runner = suit_config_map.get(fs_wrapper.SUIT_RUNNER_ATTR)
            if suit_config_map.get(fs_wrapper.SUIT_APP_NAME) != None:
                app_name =  suit_config_map.get(fs_wrapper.SUIT_APP_NAME)
            # load test cases for test suit.
            # It will aggregate all the relative suit info for this test suit, too.
            case_names = fs_wrapper.get_all_cases_py_module_name(test_suit.name)
            for case in case_names:
                case_config_map = fs_wrapper.get_test_case_config(case[1], test_suit.name)
                #if case_config_map.get(fs_wrapper.CASE_ENABLE_ATTR) == '1':
                test_case = createInstance(case[0] + fs_wrapper.DOT_TAG + case[1], case[1], suit_name, app_name)
                test_case.case_config_map = case_config_map
                test_suit.addCase(test_case)
            case_results = []
            for case in test_suit.test_cases:
                if case_name == "" or case.name == case_name:
                    set_ignore_status(True)
                    #save the current case name
                    pre_case_name = get_cur_case_name()
                    case.test_case_run(case_results)
                    #checkout the current case name
                    set_cur_case_name(pre_case_name)
                    set_ignore_status(False)
            log_test_framework(LOG_TAG,  "can not find the case name:"+case_name)
            return False
    log_test_framework(LOG_TAG,  "can not find the suit name:"+suit_name)
    return False
Esempio n. 7
0
    def getCaseList(self, base_path):
        '''
        load the test cases from the path

        @type base_path: string
        @param base_path: the path of the case
        @return: return all the cases which can found under this path
        '''
        all_case_name_list = []
        suit_name_list = fs_wrapper.get_suit_name_list(base_path)
        for suit_name in suit_name_list:
            suit_config_map = fs_wrapper.get_test_suit_config(suit_name)
            if suit_config_map.get(fs_wrapper.SUIT_ENABLE_ATTR) == '1':
                cases = fs_wrapper.get_all_cases_py_module_name(suit_name)
                case_name_list = []
                for case in cases:
                    case_name_list.append(case[1])
                    for case_name in case_name_list:
                        case_config_map = fs_wrapper.get_test_case_config(case_name, suit_name)
                        if case_config_map.get(fs_wrapper.CASE_ENABLE_ATTR) == '1':
                            all_case_name_list.append((suit_name, case_name))
        return all_case_name_list
Esempio n. 8
0
 def test_case_notification(self):
     '''
     send notification to tell user that the current case is starting
     '''
     import settings.common as SC
     if fs_wrapper.run_init_settings:
         case_utility.update_notificationbar('presettings is running...')
     else:
         set_can_continue()
         if (self.runReason == CASE_BE_REFERED):
             (ori_suit_name,
              ori_case_name) = self.original_ClassName.rsplit('.', 1)
         elif (self.runReason == CASE_RUN_SELF):
             ori_suit_name = self.suit_name
             ori_case_name = self.name
         else:
             return
         case_description = self.case_config_map.get(
             fs_wrapper.CASE_DESCRIPTION)
         if (case_description == None or case_description == ""):
             note_case_info = ori_case_name
         else:
             note_case_info = case_description
         suit_config_map = fs_wrapper.get_test_suit_config(ori_suit_name)
         suit_description = suit_config_map.get(fs_wrapper.SUIT_DESCRIPTION)
         if (suit_description == None or suit_description == ""):
             note_suit_info = ori_suit_name
         else:
             note_suit_info = suit_description
         #case_utility.update_notificationbar('(' + str(self.cycle_index) +'/' + str(SC.PUBLIC_RUNNING_REPEAT_NUMBER) + ')' + self.suit_name + '.' + self.name)
         log_test_framework(
             'notify', '(' + str(self.cycle_index) + '/' +
             str(SC.PUBLIC_RUNNING_REPEAT_NUMBER) + ')' + note_suit_info +
             '.' + note_case_info)
         case_utility.update_notificationbar(
             '(' + str(self.cycle_index) + '/' +
             str(SC.PUBLIC_RUNNING_REPEAT_NUMBER) + ')' + note_suit_info +
             '.' + note_case_info)
Esempio n. 9
0
     log_test_framework(
         TAG, "status == 1 and not is_case_in_reboot_status")
     continue
 elif status == 1 and is_case_in_reboot_status(case[1]):
     log_test_framework(TAG,
                        "status == 1 and is_case_in_reboot_status")
     status = 2
     if get_reboot_reason() == REBOOT_CRASH:
         log_test_framework(TAG,
                            "get_reboot_reason() == REBOOT_CRASH")
         qsst_log_restore_reboot()
         continue
     #qsst_log_restore_reboot()
 log_test_framework(TAG, "add case:" + case[1])
 case_suit_name = case[0][:case[0].index('.')]
 suit_config_map = fs_wrapper.get_test_suit_config(case_suit_name)
 if suit_config_map.get(fs_wrapper.SUIT_APP_NAME) != None:
     app_name = suit_config_map.get(fs_wrapper.SUIT_APP_NAME)
 case_config_map = fs_wrapper.get_test_case_config(
     case[1], case_suit_name)
 case_app_name = case_config_map.get(fs_wrapper.CASE_APP_NAME)
 if case_app_name == None or case_app_name == "":
     case_app_name = app_name
 reference = case_config_map.get(fs_wrapper.CASE_REFERENCE)
 if reference != None and reference != "":
     (ref_suit_name, ref_case_name) = reference.rsplit('.', 1)
     class_name = reference + fs_wrapper.DOT_TAG + ref_case_name
     self.addTestCase(test_suit, case_config_map, class_name,
                      ref_suit_name, ref_case_name, case_app_name,
                      case[0])
     test_suit.test_cases[-1].runReason = CASE_BE_REFERED