(self, step: TStep)
return step_data
run teststep: referenced testcase
run teststep: referenced testcase
run teststep : referenced testcase
def __run_step_testcase(self, step: TStep) -> StepData:
        """run teststep: referenced testcase"""
        step_data = StepData(name=step.name)
        step_variables = step.variables
        step_export = step.export

        # setup hooks
        if step.setup_hooks:
            self.__call_hooks(step.setup_hooks, step_variables, "setup testcase")

        if hasattr(step.testcase, "config") and hasattr(step.testcase, "teststeps"):
            testcase_cls = step.testcase
            case_result = (
                testcase_cls()
                .with_session(self.__session)
                .with_case_id(self.__case_id)
                .with_variables(step_variables)
                .with_export(step_export)
                .run()
            )

        elif isinstance(step.testcase, Text):
            if os.path.isabs(step.testcase):
                ref_testcase_path = step.testcase
            else:
                ref_testcase_path = os.path.join(
                    self.__project_meta.RootDir, step.testcase
                )

            case_result = (
                HttpRunner()
                .with_session(self.__session)
                .with_case_id(self.__case_id)
                .with_variables(step_variables)
                .with_export(step_export)
                .run_path(ref_testcase_path)
            )

        else:
            raise exceptions.ParamsError(
                f"Invalid teststep referenced testcase: {step.dict()}"
            )

        # teardown hooks
        if step.teardown_hooks:
            self.__call_hooks(step.teardown_hooks, step.variables, "teardown testcase")

        step_data.data = case_result.get_step_datas()  # list of step data
        step_data.export_vars = case_result.get_export_variables()
        step_data.success = case_result.success
        self.success = case_result.success

        if step_data.export_vars:
            logger.info(f"export variables: {step_data.export_vars}")

        return step_data
def __run_step_testcase ( self , step : TStep ) -> StepData : step_data = StepData ( name = step . name ) step_variables = step . variables step_export = step . export # setup hooks if step . setup_hooks : self . __call_hooks ( step . setup_hooks , step_variables , "setup testcase" ) if hasattr ( step . testcase , "config" ) and hasattr ( step . testcase , "teststeps" ) : testcase_cls = step . testcase case_result = ( testcase_cls ( ) . with_session ( self . __session ) . with_case_id ( self . __case_id ) . with_variables ( step_variables ) . with_export ( step_export ) . run ( ) ) elif isinstance ( step . testcase , Text ) : if os . path . isabs ( step . testcase ) : ref_testcase_path = step . testcase else : ref_testcase_path = os . path . join ( self . __project_meta . RootDir , step . testcase ) case_result = ( HttpRunner ( ) . with_session ( self . __session ) . with_case_id ( self . __case_id ) . with_variables ( step_variables ) . with_export ( step_export ) . run_path ( ref_testcase_path ) ) else : raise exceptions . ParamsError ( f"Invalid teststep referenced testcase: {step.dict()}" ) # teardown hooks if step . teardown_hooks : self . __call_hooks ( step . teardown_hooks , step . variables , "teardown testcase" ) step_data . data = case_result . get_step_datas ( ) # list of step data step_data . export_vars = case_result . get_export_variables ( ) step_data . success = case_result . success self . success = case_result . success if step_data . export_vars : logger . info ( f"export variables: {step_data.export_vars}" ) return step_data