2017-02-22 108 views
0

以下代碼位於For循環中。機器人測試框架:運行關鍵字如果發生用戶關鍵字不包含關鍵字

ELSE Enable Laser ${app_id} ${status}招聘用戶關鍵字「啓用激光」不包含關鍵字錯誤。但是,如果我將其更改爲ELSE IF '${electricalApp}'=='True' Enable Laser ${app_id} ${status},則此線路上沒有錯誤,但線路Run Keyword If '${electricalApp}'=='True' Enable Laser ${app_id} ${status}正下方,發生用戶關鍵字「啓用激光」不包含關鍵字錯誤。

\ ${electricalApp} Is App Electrical ${app} 
\ ${status} Set Variable ON 
\ ${validOptic} Set Variable False 
\ ${validOptic} Run Keyword If '${electricalApp}'=='False' Is Optic Valid For App ${app_id} ${app} 
\ ...    ELSE Enable Laser ${app_id} ${status} 
\ Run Keyword If '${validOptic}'=='True' Enable Laser ${app_id} ${status} 
\ ${status} Set Variable OFF 
\ Run Keyword If '${electricalApp}'=='True' Enable Laser ${app_id} ${status} 
\ Run Keyword If '${validOptic}'=='True' Enable Laser ${app_id} ${status} 
\ Exit Current Running Apps 

在我將上面的代碼放到For循環之前,一切正常。

編輯:啓用激光:

Enable Laser [Arguments]  ${app_id} ${status} 
[Documentation]  Turn on or off laser and then check Signal Sync Link. ${status} should be all upper case 
    ${commmand} Catenate SEPARATOR= ${app_id} .0.SignalTx.LaserEnable 
    send cmd ${app_id} a_goto_state ${commmand} ${status} 
    ${inquiry} Catenate SEPARATOR= ${app_id} .0.SignalTx.LaserState 
    ${payload} send cmd ${app_id} r_get ${inquiry} 
    ${parameters} Evaluate $payload.parameters 
    Run Keyword If '${status}'=='ON' Should Be Equal '1' ${parameters} Current state should be 1 
    Run Keyword If '${status}'=='OFF' Should Be Equal '0' ${parameters} Current state should be 0 
    Signal Sync Link Verification ${app_id} ${status} 
+0

請您跟我們說,關鍵字的代碼共享'啓用Laser'? –

+0

@JanKovarik謝謝,代碼已被添加。 – Henry

+0

請修正代碼的格式。第一個塊混亂了,代碼與文本混合在一起。 –

回答

1

原來在Enable Laser的定義中,要縮進[Documentation]需求。

這樣的:

Enable Laser [Arguments]  ${app_id} ${status} 
    [Documentation]  Turn on or off laser and then check Signal Sync Link. ${status} should be all upper case 
    ${commmand} Catenate SEPARATOR= ${app_id} .0.SignalTx.LaserEnable 
    send cmd ${app_id} a_goto_state ${commmand} ${status} 
+0

這太瘋狂了。我沒有注意到,也沒有嘗試複製粘貼。無論如何,我很高興你解決了這個問題。 –

+0

無論如何謝謝你。確實很瘋狂,這個狗屎持續了我近1天。 – Henry