def _execute_runmode_step(self, runmode_timer, runmode, step_status, value):
     """
     This function will execute a runmode step
     """
     runmode_evaluation = any([runmode == "RMT",
                               runmode == "RUF" and step_status is True,
                               runmode == "RUP" and step_status is False])
     if runmode_timer is not None and runmode_evaluation:
         pNote("Wait for {0}sec before the next runmode attempt ".format(runmode_timer))
         wait_for_timeout(runmode_timer)
     # if runmode is 'ruf' & step_status is False, skip the repeated
     # execution of same TC step and move to next actual step
     elif runmode == "RUF" and step_status is False:
         self.go_to_step_number = str(value)
     # if runmode is 'rup' & step_status is True, skip the repeated
     # execution of same TC step and move to next actual step
     elif runmode == "RUP" and step_status is True:
         self.go_to_step_number = str(value)
     else:
         if step_status is False or str(step_status).upper() in ["ERROR", "EXCEPTION"]:
             self.go_to_step_number = onerror_driver.main(self.current_step, self.default_error_action,
                                                self.default_error_value, skip_invoked=self.skip_invoked)
             if self.go_to_step_number in ['ABORT', 'ABORT_AS_ERROR']:
                 return self.current_step_number, self.go_to_step_number, "break"
             elif type(self.go_to_step_number) is list:
                 self.__run_execute_and_resume_mode()
     return self.current_step_number, self.go_to_step_number, "continue"
    def _execute_retry_type_step(self, retry_type, retry_cond,
                                 retry_cond_value, retry_interval,
                                 retry_value):
        """
        This function will execute a retry step

        """
        if retry_type.upper() == 'IF':
            try:
                if self.data_repository[retry_cond] == retry_cond_value:
                    condition_met = True
                    pNote("Wait for {0} sec before retrying".format(
                        retry_interval))
                    pNote("The given condition '{0}' matches the expected "
                          "value '{1}'".format(
                              self.data_repository[retry_cond],
                              retry_cond_value))
                    wait_for_timeout(retry_interval)
                else:
                    condition_met = False
                    print_warning(
                        "The condition value '{0}' does not match with the "
                        "expected value '{1}'".format(
                            self.data_repository[retry_cond],
                            retry_cond_value))
            except KeyError:
                print_warning("The given condition '{0}' do not exists in "
                              "the data repository".format(retry_cond_value))
                condition_met = False
            if condition_met is False:
                self.go_to_step_number = str(retry_value)
        else:
            if retry_type.upper() == 'IF NOT':
                try:
                    if self.data_repository[retry_cond] != retry_cond_value:
                        condition_met = True
                        pNote("Wait for {0}sec before retrying".format(
                            retry_interval))
                        pNote(
                            "The condition value '{0}' does not match with the expected "
                            "value '{1}'".format(
                                self.data_repository[retry_cond],
                                retry_cond_value))
                        wait_for_timeout(retry_interval)
                    else:
                        condition_met = False
                except KeyError:
                    condition_met = False
                    print_warning(
                        "The given condition '{0}' is not there in the data repository"
                        .format(retry_cond_value))
                if not condition_met:
                    pNote("The given condition '{0}' matched with the "
                          "value '{1}'".format(
                              self.data_repository[retry_cond],
                              retry_cond_value))
                    self.go_to_step_number = str(retry_value)
        return self.current_step_number, self.go_to_step_number, "continue"
Example #3
0
    def wait_for_timeout(self, timeout):
        """waits (sleeps) for the time provided

        :Arguments:
            1. timeout= time to wait in seconds

        :Returns:
            1. status (bool)
        """

        WDesc = "Waits for the timeout provided"
        Utils.testcase_Utils.pSubStep(WDesc)
        status = datetime_utils.wait_for_timeout(timeout)
        pNote('********Below Testing occured after Timeout *********')
        Utils.testcase_Utils.report_substep_status(status)
        return status
Example #4
0
    def wait_for_timeout(self, timeout, notify_count=4):
        """waits (sleeps) for the time provided

        :Arguments:
            1. timeout= time to wait in seconds
            2. notify_count= number of times, the user needs to be notified
                             during wait time. Default value is 4.
                             Ex: If the notify_count=4 and timeout=400
                             the timeout is divided into 4 partitions
                             each as 100 and notified to user as
                             100(25%),200(50%),300(75%),400(100%)
        :Returns:
            1. status (bool)
        """

        WDesc = "Waits for the timeout provided"
        Utils.testcase_Utils.pSubStep(WDesc)
        print_info("Command timeout for {0} seconds".format(timeout))
        status = datetime_utils.wait_for_timeout(timeout, notify_count=notify_count)
        pNote('********Below Testing occured after Timeout *********')
        Utils.testcase_Utils.report_substep_status(status)
        return status
 step_status_list.append(step_status)
 kw_resultfile_list.append(kw_resultfile)
 step_impact_list.append(step_impact)
 runmode, value, runmode_timer = common_execution_utils.get_runmode_from_xmlfile(
     step)
 retry_type, retry_cond, retry_cond_value, retry_value, retry_interval = \
     common_execution_utils.get_retry_from_xmlfile(step)
 if runmode is not None:
     if runmode_timer is not None and\
         any([runmode == "RMT",
              runmode == "RUF" and step_status is True,
              runmode == "RUP" and step_status is False]):
         pNote(
             "Wait for {0}sec before the next runmode attempt ".format(
                 runmode_timer))
         wait_for_timeout(runmode_timer)
     # if runmode is 'ruf' & step_status is False, skip the repeated
     # execution of same TC step and move to next actual step
     elif runmode == "RUF" and step_status is False:
         goto_stepnum = str(value)
     # if runmode is 'rup' & step_status is True, skip the repeated
     # execution of same TC step and move to next actual step
     elif runmode == "RUP" and step_status is True:
         goto_stepnum = str(value)
     else:
         if step_status is False or str(step_status).upper() == "ERROR" \
         or str(step_status).upper() == "EXCEPTION":
             goto_stepnum = onerror_driver.main(step,
                                                default_error_action,
                                                default_error_value)
             if goto_stepnum in ['ABORT', 'ABORT_AS_ERROR']: