Exemplo n.º 1
0
def backup_to_local():
    work_dir = cur_loc + "/" + QSST_BACKUP + "/" + PREFIX + curTime
    makedirs(work_dir)
    makedirs(work_dir + "/settings")
    copy(cur_loc + "/settings/config.xml", work_dir + "/settings")
    suit_list = fs_wrapper.get_suit_name_list(cur_loc + "/")
    for suit in suit_list:
        makedirs(work_dir + "/" + suit)
        copy(cur_loc + "/" + suit + "/" + suit + ".xml", work_dir + "/" + suit)
        case_list = fs_wrapper.get_all_cases_py_module_name(suit, False)
        for case in case_list:
            copy(cur_loc + "/" + suit + "/" + case[1] + ".xml",
                 work_dir + "/" + suit)

    bg_suit_list = fs_wrapper.get_suit_name_list(cur_loc + "/" +
                                                 BACKGROUND_CASE_POOL + "/")
    for bg_suit in bg_suit_list:
        makedirs(work_dir + "/" + BACKGROUND_CASE_POOL + "/" + bg_suit)
        copy(
            cur_loc + "/" + BACKGROUND_CASE_POOL + "/" + bg_suit + "/" +
            bg_suit + ".xml",
            work_dir + "/" + BACKGROUND_CASE_POOL + "/" + bg_suit)
        bg_case_list = fs_wrapper.get_all_cases_py_module_name(bg_suit, True)
        for bg_case in bg_case_list:
            copy(
                cur_loc + "/" + BACKGROUND_CASE_POOL + "/" + bg_suit + "/" +
                bg_case[1] + ".xml",
                work_dir + "/" + BACKGROUND_CASE_POOL + "/" + bg_suit)
Exemplo 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
Exemplo n.º 3
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 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
Exemplo 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
Exemplo n.º 5
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
Exemplo n.º 6
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
Exemplo n.º 7
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