Return two values in Robot Framework

kame picture kame · Jul 18, 2016 · Viewed 13k times · Source

Is there a possibility to return two variables in Robot Framework?

${result1}, ${result2}=    MyKeyword

doesn't work.

Answer

Bryan Oakley picture Bryan Oakley · Jul 18, 2016

Yes, just place the variables in separate cells, both when assigning and when returning the values.

For example:

*** Test Case ***
Example
    ${value1}    ${value2}    return two values
    Should be equal    ${value1}    this is value 1
    Should be equal    ${value2}    this is value 2


*** Keywords ***
Return two values
    ${v1}=      set variable    this is value 1
    ${v2}=      set variable    this is value 2

    [Return]    ${v1}    ${v2}