我有如下關鍵詞:機器人測試框架:Set Variable如何工作?
App For Port [Arguments] ${app}
# Try to launch one app on either port, continue if it fails on port 1 and launch it on port 2, record if it fails on both.
${returned_port} Set Variable ${1}
: FOR ${port_num} IN 1 2
\ ${returned_port} Set Variable If ${port_num} == 2 ${2}
\ Check App Launch ${app} ${port_num}
Return From Keyword ${returned_port}
${returned_port} Set Variable ${1}
工作正常,${returned_port}
這行之後爲1。
但是, ${returned_port} Set Variable If ${port_num} == 2 ${2}
給出${returned_port}
沒有值。
我真的很困惑。我怎樣才能讓它設置${returned_port}
爲2?提前致謝!!
感謝,這是有道理的。但是爲了簡化代碼,因爲我需要返回'Check App Launch'的實際用於上層關鍵字的端口,所以我想我需要保持代碼 – Henry
對我有意義。我很高興它有幫助。 –