robot framework->写个简单的例子(2)

robot framework的基础关键字封装在Builtin库中,

其他基础库:

Dialogs, Collections, OperatingSystem, Remote, Screenshot,

String, Telnet, XML, Process, DateTime

 

1,File --->new project

name -->项目名 type 类型 file 文件 Drectory 项目目录

parent Drectory -->项目路径 format 文件格式 RoBOT 标准格式 txt文件格式 TSV HTML

2,Add Suite -->创建测试套件

 

 

3,new Test Case --->创建测试用例

 

Robot FramWork之 Builtin

定义变量:

variable

${ a } set variable hello world

log ${ a }

定义列表:

list

${ abc } create List a b c

log ${ abc }

链接字符串:

catenate

${ hi } catenate hello world

log ${ hi }

时间关键:

time

${ t } get time

log ${ t }

sleep 5 延迟5秒

${ t } get time 获取当前系统时间

log ${ t }

分支语句关键字:

if

${ a } set variable 59

run keyworld if ${ a }>=90 log 优秀

else if ${ a }<=70 log 良好

else if ${ a }<=60 log 及格

else log 不及格

循环语句关键字

for

:FOR ${ i } in range 10

log ${ i }

强大的Evaluate 可以调用python脚本

evaluate

${ d } Evaluate random.randint(1000,999) randon

log ${ d }

 

python.py

import random

 

number = random.randint(1000, 9000)

print(number)

 

你可能感兴趣的:(测试,robot,framework)