Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify empty list, empty dict and Boolean as a default value for a robot framework keyword.?

I want to specify default values like in python

def my_function(arg1="my_string", arg2=[], arg3={}, arg4=True):
    pass

The following is a sample keyword definition equivalent to above. I want to specify default values.

*** Keywords ***
My Function

    [Arguments]     ${ARG1}=my_default_string    ${ARG2}= <How to specify empty list)    ${ARG3}= <How to specify empty dict)    ${ARG4}= <How to specify boolean true)

    some statements
    some more statements
like image 887
Jomin Avatar asked Dec 22 '25 14:12

Jomin


1 Answers

For empty array, dictionary, etc. use these predefined constants:

${EMPTY} # 
@{EMPTY} # = empty array
&{EMPTY} # = empty dictionary

read documentation

like image 107
lucky62 Avatar answered Dec 24 '25 03:12

lucky62