Patricio Iglesias
Patricio Iglesias

Reputation: 67

RobotFramework - keyword assign multiple variables, how to execute it only if condition?

I have a Keyword that returns multiple values, reading from a file. I use it to set some variables like this:

${A}    ${B}    ${C}    ${D}    ${E}    ObtainVariablesKeyword

Where ObtainVariablesKeyword has some code and finally:

[Return]  ${A}    ${B}    ${C}    ${D}    ${E}

The thing is sometimes data is not in a file, instead user write it., So i'd like to run first example row only IF CONDITION.

Does anybody know how?

Run Keyword If CONDITION KEYWORD does not allow to put variables after condition, because it waits for a keyword.

Upvotes: 1

Views: 2623

Answers (2)

Venkatarao Dadi
Venkatarao Dadi

Reputation: 96

@{list1}= ObtainVariablesKeyword

@{userlist}= Create List ${uservariableA} ${uservariableB} ${uservariableC} ${uservariableD} ${uservariableE}

${A} ${B} ${C} ${D} ${E}= Run Keyword If @{list1}!=None Set Variable @{list1} ... ELSE Set Variable @{userlist}

Upvotes: 0

Psytho
Psytho

Reputation: 3384

One possibility is to create another keyword:

AssignValues
    ${A}    ${B}    ${C}    ${D}    ${E}    ObtainVariablesKeyword

And then call this keyword after Run Keyword If:

Run Keyword if '${flag}'= 'TRUE' AssignValues

Upvotes: 0

Related Questions