2015-05-20 74 views
1

有時候我機器人框架Telnet連接重試

> error: [Errno 111] Connection refused 

,然後我所有的測試失敗。尋找一種強制telnet重試幾次的方法。

這是我的連接命令看起來像:

> Telnet.Open Connection ${IP} \ \ \ \r None 
+0

你能從測試中發佈一些telnet連接代碼嗎? – Pekka

+0

Telnet.Open Connection $ {IP} \ \ \ \ r無 – user2988257

回答

3

您可以使用Wait Until Keyword Succeeds。例如,你可以每隔15秒嘗試兩分鐘,如下所示:

Example 
    Wait until keyword succeeds 2 minutes 15 seconds 
    \ Telnet.Open Connection ${IP} \ \ \ \r None 
1

For循環應該工作:

: FOR ${counter} IN RANGE  3 
    \ ${success}= Run Keyword And Return Status Telnet.Open Connection  ${IP} 
    \ Exit For Loop If ${success}