Robot Framework Integrated Development Environment (RIDE)
robotide.lib.robot.libraries.BuiltIn Namespace Reference

Classes

class  _BuiltInBase
 
class  _Control
 
class  _Converter
 
class  _Misc
 
class  _RunKeyword
 
class  _Variables
 
class  _Verify
 
class  BuiltIn
 An always available standard library with often needed keywords. More...
 
class  RobotNotRunningError
 Used when something cannot be done because Robot is not running. More...
 

Functions

def register_run_keyword (library, keyword, args_to_process=None, deprecation_warning=True)
 Registers 'run keyword' so that its arguments can be handled correctly. More...
 
def run_keyword_variant (resolve)
 

Function Documentation

◆ register_run_keyword()

def robotide.lib.robot.libraries.BuiltIn.register_run_keyword (   library,
  keyword,
  args_to_process = None,
  deprecation_warning = True 
)

Registers 'run keyword' so that its arguments can be handled correctly.

*NOTE:* This API will change in RF 3.1. For more information see
https://github.com/robotframework/robotframework/issues/2190. Use with
`deprecation_warning=False` to avoid related deprecation warnings.

1) Why is this method needed

Keywords running other keywords internally (normally using `Run Keyword`
or some variants of it in BuiltIn) must have the arguments meant to the
internally executed keyword handled specially to prevent processing them
twice. This is done ONLY for keywords registered using this method.

If the register keyword has same name as any keyword from Robot Framework
standard libraries, it can be used without getting warnings. Normally
there is a warning in such cases unless the keyword is used in long
format (e.g. MyLib.Keyword).

Keywords executed by registered run keywords can be tested in dry-run mode
if they have 'name' argument which takes the name of the executed keyword.

2) How to use this method

`library` is the name of the library where the registered keyword is
implemented.

`keyword` can be either a function or method implementing the
keyword, or name of the implemented keyword as a string.

`args_to_process` is needed when `keyword` is given as a string, and it
defines how many of the arguments to the registered keyword must be
processed normally. When `keyword` is a method or function, this
information is got directly from it so that varargs (those specified with
syntax '*args') are not processed but others are.

3) Examples

from robotide.lib.robot.libraries.BuiltIn import BuiltIn, register_run_keyword

def my_run_keyword(name, *args):
    # do something
    return BuiltIn().run_keyword(name, *args)

# Either one of these works
register_run_keyword(__name__, my_run_keyword)
register_run_keyword(__name__, 'My Run Keyword', 1)

-------------

from robotide.lib.robot.libraries.BuiltIn import BuiltIn, register_run_keyword

class MyLibrary:
    def my_run_keyword_if(self, expression, name, *args):
        # do something
        return BuiltIn().run_keyword_if(expression, name, *args)

# Either one of these works
register_run_keyword('MyLibrary', MyLibrary.my_run_keyword_if)
register_run_keyword('MyLibrary', 'my_run_keyword_if', 2)

Definition at line 3626 of file BuiltIn.py.

◆ run_keyword_variant()

def robotide.lib.robot.libraries.BuiltIn.run_keyword_variant (   resolve)

Definition at line 49 of file BuiltIn.py.