天天看點

robot相當于python(類比)

**變量

robot相當于python(類比)

Robot:

${scrlar}

@{list}

&{dict}

相當于Python:

str

list[]

dict[]

**導庫

robot相當于python(類比)

Robot:

***Setting***

Library   <自定義庫>

Resource   <資源檔案>

Variables   <變量檔案>

相當于Python:

import  <…>

**列印

robot相當于python(類比)

Robot:

Log to Console   <…>

相當于Python:

print(<…>)

**循環

robot相當于python(類比)

Robot:

:FOR  <…>  IN  <…>

\  <…>

相當于Python:

for <…> in <…>:

    <…>

robot相當于python(類比)

Robot:

:For  <…>  In Range  9999

\  Continue For Loop if  <bool>

\  Exit For Loop if  <bool>

相當于Python:

while True:

if <bool>:

continue

if <bool>:

break

**條件判斷

robot相當于python(類比)

Robot:

Run Keyword If  <bool>  <…>

相當于Python:

if <bool>:

<…>

robot相當于python(類比)

Robot:

Run Keyword If  <bool>  <…>

  …  ELSE IF  <bool>  <…>

  …  ELSE  <…>

相當于Python:

if <bool>:

<…>

elif <bool>:

<…>

else:

<...>

===============常用語句===============

***Setting***

Library   <第三方庫>

Library   <自定義庫.py>

Library   <子產品.類>  (導入python類關鍵字)

Resource   <資源檔案.robot>

Variables   <變量檔案.py> 或者 <變量檔案.robot>

Force Tags   <标簽>  <标簽>

Defaut Tags   <标簽> 

**常用關鍵字

:FOR   <…>   IN   <…>

Run Keyword If  <bool>  <…>

Run Keywords   <…>   AND   <…>

Evaluate  <python>

log to console  <…>

**常用檢查點關鍵字

Should Be Ture  <bool>

Should Be Equal  <…>  <…>

Should Contain  <…>

set variable  <…>

sleep

**常用指令行

執行測試用例:robot --pythonpath . tc.robot

執行參數檔案:robot -A <argfilename>

繼續閱讀