Run keyword if empty or not existing

9,981 views
Skip to first unread message

IMMO WETZEL

unread,
Apr 17, 2013, 3:39:02 PM4/17/13
to robotframe...@googlegroups.com

Hi folks,

 

Are there any useful way to execute a keyword if a variable is empty or not existing on an easy way.

 

Currentlz I wrote some special keyword but I guess there is a better solution.

The Variable will be set via --variable on the commandline with a long path like “/ftp/mach/was/di\ \ r/nix”

 

Testsuite:

 

*** Variables ***

${thats2check}    ${empty}    # the variable should be empty by default

 

*** Test Cases ***

testewas

    Run Keyword If Empty    ${ thats2check}    Fatal Error    Variable \$\{ thats2check\} Missing

 

 

With kind regards

 

Immo Wetzel

 

 

Florian Heine

unread,
Apr 18, 2013, 2:35:18 AM4/18/13
to robotframe...@googlegroups.com
Hello,

The way I do that is by using the Run Keyword If keyword from the buitin library:

Run Keyword If '${ thats2check}'=='${EMPTY}'    Fatal Error    Variable \$\{ thats2check\} Missing

Note the use of quotes to make the expression space sensitive.

See here for the docs:

Florian
Reply all
Reply to author
Forward
0 new messages