Paweł Wojtal
Paweł Wojtal

Reputation: 350

How to embed arguments into Robot Framework keyword name

I've tried to make some keywords in Robot Framework which has arguments embedded in the keyword name, according to (Robot Docs), but unfortunately I'm always getting None when I'm checking what is under the variable. Did you meet such behaviour? What have I done wrong??

My keyword example:

Set ${object} state to ${state}
    Log To Console  ${object}
    Log To Console  ${state}

Let's assume that ${object} and ${state} are strings, so the call of this keyword looks like this:

${status}=  Run Keyword And Return Status  Set camera state to locked

Upvotes: 2

Views: 7188

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

Your code is fine. Here is a complete working example:

*** Keywords ***
Set ${object} state to ${state}
    Log To Console    ${object}
    Log To Console    ${state}

*** Test Cases ***
Example test case
    ${status}=        Run Keyword And Return Status    Set camera state to locked
    Should be True    ${status}

Upvotes: 3

Related Questions