在 RobotFramework 4 中,我們現在可以撰寫更傳統的 if/else 陳述句。
所以像:
*** Keywords ***
Do conditional execution
IF ${CONDITION}
Log True!
ELSE IF "cat" == "dog"
Log Dog!
ELSE
Log Not True!
END
有誰知道如何用多個條件撰寫它?我目前正在做一些事情。如果我像這樣寫多個陳述句,它會起作用
IF "${error1}" == "False"
Do Something
ELSE IF "${error2}" == "False"
Do Something
ELSE IF "${error3}" == "False"
Do Something
但如果我試著這樣寫
IF "${error1}" == "False" or "${error2}" == "False" or "${error3}" == "False"
Write To Google Document
然后它告訴我
IF has more than one condition.
如果我寫錯了有什么想法嗎?或者,還有更好的方法?
uj5u.com熱心網友回復:
在您的代碼中,“或”前有兩個空格。運算式中不能有兩個或多個空格。您的運算式中有“或”。
這應該有效:
IF "${error1}" == "False" or "${error2}" == "False" or "${error3}" == "False"
Write To Google Document
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/352831.html
下一篇:測驗托管緩沖區的最佳實踐?
