kame
kame

Reputation: 22010

Return two values in Robot Framework

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

${result1}, ${result2}=    MyKeyword

doesn't work.

Upvotes: 12

Views: 30316

Answers (3)

Seth
Seth

Reputation: 716

${result1}    ${result2} =    MyKeyword

worked for me.

${result1}    ${result2}    =    MyKeyword

gave me:

No keyword with name '=' found.

In case it matters, I'm using spaces only, no tabs.

Upvotes: 5

shicky
shicky

Reputation: 2126

Remove the ,

${result1}    ${result2}    =    MyKeyword

Upvotes: 6

Bryan Oakley
Bryan Oakley

Reputation: 386382

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} 

Upvotes: 22

Related Questions