def test_case_end(self):
        '''
        record the case result

        '''
        log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR],
                      TAG + ' : end')
        if can_continue() and case_flag == True:
            log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR],
                          TAG + ' : case pass')
            print_report_line(self.case_config_map[fs_wrapper.CASE_NAME_ATTR] +
                              TAG + ' : \tpass')
        else:
            log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR],
                          TAG + ' : case fail')
            print_report_line(self.case_config_map[fs_wrapper.CASE_NAME_ATTR] +
                              TAG + ' : \tfail')
        save_fail_log()
    def test_suit_main(self, suit_results):
        '''
        the subclass need to override this function to do itself things

        @type suit_results: array
        @param suit_results: the case result array.
        '''
        case_results = []
        #run case one by one
        for case in self.test_cases:
            case.test_case_run(case_results)

        #report case results
        if not fs_wrapper.run_init_settings:
            count = len(case_results)
            success = 0
            for result in case_results:
                if result[1]:
                    success += 1
            print_report_line("Total:" +str(success) + '/' + str(count),)
    def test_case_end(self):
        '''
        record the case result
        '''
        '''
        @attention: modify by min.sheng
        '''
        log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR], TAG + ' : end')
        if can_continue() and case_flag == True:
            # shutdown()
            log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR], TAG + ': case pass')
            print_report_line(self.case_config_map[fs_wrapper.CASE_NAME_ATTR] + TAG + ' : \tpass')
        else:
            log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR], TAG + ' : case fail')
            print_report_line(self.case_config_map[fs_wrapper.CASE_NAME_ATTR] + TAG + ' : \tfail')
            save_fail_log()
        p.terminate()
        
                

            
class TestSuitBase(object):
    """The base class for test suit"""
    def __init__(self, name, suit_info, runner='robotium', enabled=True):
        self.name = name
        self.suit_info = suit_info
        self.runner = runner
        self.enabled = enabled
        self.test_cases = []
        self.relative_suits = []

    def addCase(self, case):
        '''
        add case to this suit

        @type case: L{TestCaseBase<TestCaseBase>}
        @param case: which case need to added
        '''
        self.test_cases.append(case)

    def test_suit_run(self, suit_results):
        '''
        the entry of the suit.through this method to control the suit life cycle.

        @type suit_results: array
        @param suit_results: the case result array.
        '''
        if self.test_suit_init(suit_results):
            #t1=threading.Thread(target=record_screen,args=('haha',))
            #t2=threading.Thread(target=self.test_suit_main,args=suit_results,)
            #t1.start()
            #t1.join()
            #t2.start()
            #t2.join()
            self.test_suit_main(suit_results)
            self.test_suit_end(suit_results)
            return True
        else:
            log_test_framework(self.name, "suit init fail")
            self.test_suit_end(suit_results)
            return False

    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

    def test_suit_end(self, suit_results):
        '''
        end the test suit . save some loggoing
        '''
        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(END + self.name, suit_description)
            else:
                insert_waypoint(
                    END + '(' + str(TestCaseBase.cycle_index) + '/' +
                    str(SC.PUBLIC_RUNNING_REPEAT_NUMBER) + ') ' + self.name,
                    suit_description)

        log_test_framework(self.name, "suit end")
        qsst_log_suit_end()

    def test_suit_main(self, suit_results):
        '''
        the subclass need to override this function to do itself things

        @type suit_results: array
        @param suit_results: the case result array.
        '''
        case_results = []
        #run case one by one
        for case in self.test_cases:
            case.test_case_run(case_results)

        #report case results
        if not fs_wrapper.run_init_settings:
            count = len(case_results)
            success = 0
            for result in case_results:
                if result[1]:
                    success += 1
            print_report_line("Total:" + str(success) + '/' + str(count), )