robot对比python(相当于)
**变量
Robot:
${scrlar}
@{list}
&{dict}
相当于Python:
str
list[]
dict[]
**导库
Robot:
Setting
Library <自定义库>
Resource <资源文件>
Variables <变量文件>
相当于Python:
import <…>
**打印
Robot:
Log to Console <…>
相当于Python:
print(<…>)
**循环
Robot:
:FOR <…> IN <…>
\ <…>
相当于Python:
for <…> in <…>:
<…>
Robot:
:For <…> In Range 9999
\ Continue For Loop if
\ Exit For Loop if
相当于Python:
while True:
if :
continue
if :
break
**条件判断
Robot:
Run Keyword If <…>
相当于Python:
if :
<…>
Robot:
Run Keyword If <…>
… ELSE IF <…>
… ELSE <…>
相当于Python:
if :
<…>
elif :
<…>
else:
<...>
===============常用语句===============
Setting
Library <第三方库>
Library <自定义库.py>
Library <模块.类> (导入python类关键字)
Resource <资源文件.robot>
Variables <变量文件.py> 或者 <变量文件.robot>
Force Tags <标签> <标签>
Defaut Tags <标签>
**常用关键字
:FOR <…> IN <…>
Run Keyword If <…>
Run Keywords <…> AND <…>
Evaluate
log to console <…>
**常用检查点关键字
Should Be Ture
Should Be Equal <…> <…>
Should Contain <…>
set variable <…>
sleep
**常用命令行
执行测试用例:robot --pythonpath . tc.robot
执行参数文件:robot -A