“Run Keyword If” and setting a variable

一笑奈何 提交于 2019-12-01 06:31:45
Bryan Oakley

Run keyword if returns the result of the keyword that you're running. So, like with any other keyword, you put a variable in the first column if you want to save the value:

${device_serial}=  run keyword if  ${MAC} == 110299160221421  
...    set variable    ${device_serial_1}

I this specific case you might want to use Set Variable If instead of Run Keyword If

${device_serial}=  set variable if  ${MAC} == 110299160221421
...    ${device_serial_1}

It worked with this code:

*** Test Cases ***
Run Keyword If    ${MAC} == 110299160221421    myKeyword    

*** Keywords ***
myKeyword
    ${device_serial}=    set variable    ${device_serial_1}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!