def loadTestSuit(self, base_path):
        '''
        load the test suits from the path

        @type base_path: string
        @param base_path: the path of the suit
        @return: return all the suits which can found under this path
        '''

        # load enabled suit as a list
        suit_names = fs_wrapper.get_suit_name_list(base_path)
        suit_list = []
        status = 0
        if case_utility.is_in_reboot_status():
            status = 1
        for suit_name in suit_names:
            log_test_framework(TAG, "loadTestSuit suit_name:"+suit_name)
            if status == 1 and not case_utility.is_suit_in_reboot_status(suit_name):
                log_test_framework(TAG, "loadTestSuit in not reboot status")
                continue
            elif status == 1 and case_utility.is_suit_in_reboot_status(suit_name):
                log_test_framework(TAG, "loadTestSuit in reboot status")
                status = 2
            suit_py_module_name = fs_wrapper.get_suit_py_module_name(suit_name)
            if len(suit_py_module_name) == 0:
                continue
            # load test suit one by one
            test_suit = self.loadTestSuitFromName(suit_py_module_name, suit_name)
            if test_suit != None:
                log_test_framework(test_suit.name, "suit added")
                suit_list.append(test_suit)

        return suit_list
Exemple #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
Exemple #3
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
Exemple #4
0
    def loadTestSuit(self, base_path):
        '''
        load the test suits from the path

        @type base_path: string
        @param base_path: the path of the suit
        @return: return all the suits which can found under this path
        '''

        # load all suits as a list
        suit_names = fs_wrapper.get_suit_name_list(base_path)
        suit_list = []
        status = 0
        if case_utility.is_in_reboot_status():
            status = 1
        for suit_name in suit_names:
            log_test_framework(TAG, "loadTestSuit suit_name:" + suit_name)
            if status == 1 and not case_utility.is_suit_in_reboot_status(
                    suit_name):
                log_test_framework(TAG, "loadTestSuit in not reboot status")
                continue
            elif status == 1 and case_utility.is_suit_in_reboot_status(
                    suit_name):
                log_test_framework(TAG, "loadTestSuit in reboot status")
                status = 2
            suit_py_module_name = fs_wrapper.get_suit_py_module_name(suit_name)
            if len(suit_py_module_name) == 0:
                continue
            # load test suit one by one
            test_suit = self.loadTestSuitFromName(suit_py_module_name,
                                                  suit_name)
            if test_suit != None:
                log_test_framework(test_suit.name, "suit added")
                suit_list.append(test_suit)

        return suit_list