Robot Framework可以做什么

Robot Framework是一个用关键字驱动的测试框架,常用于GUI的自动化测试中

 

1、环境搭建

-- python

--setuptools

-- RobotFramework

--wxpython

--robotframework-ride

ride要求wx版本为2.8,若wxpython版本高于2.8,可修改rideide目录下的__init__文件,使其兼容3.0。

 

2、ride

工程 -- 测试套件 -- 测试案例

-- 资源文件:用来存放用户自定义的关键字

-- 变量:${var}(单值变量)、@{var}(list类型变量)、%{var}(环境变量引用)

-- 字符串:1234abc${var}lgkf(嵌入变量直接合在一起写即可)

-- 关键字:每个关键字可以理解为一个函数

-- 循环:FOR

-- 判断:Run Keyword If

 

3、 RF测试库

 

即RF中的关键字

 

1)内置测试库

Evaluate:

Should:

Convert to:

Run Keyword:

 

Call Method  ·  Catenate  ·  Comment  ·  Convert To Binary  ·  Convert To Boolean  ·  Convert To Hex  ·  Convert To Integer  ·  Convert To Number  ·  Convert To Octal  ·  Convert To String  ·  Create List  ·  Evaluate ·  Exit For Loop  ·  Fail  ·  Fatal Error  ·  Get Count  ·  Get Length  ·  Get Library Instance  ·  Get Time ·  Get Variable Value  ·  Get Variables  ·  Import Library  ·  Import Resource  ·  Import Variables  ·  Keyword Should Exist  ·  Length Should Be  ·  Log  ·  Log Many  ·  Log Variables  ·  No Operation  ·  Regexp Escape  ·  Remove Tags  ·  Repeat Keyword  ·  Replace Variables  ·  Run Keyword  ·  Run Keyword And Continue On Failure  ·  Run Keyword And Expect Error  ·  Run Keyword And Ignore Error  ·  Run Keyword If  ·  Run Keyword If All Critical Tests Passed  ·  Run Keyword If All Tests Passed  ·  Run Keyword If Any Critical Tests Failed  ·  Run Keyword If Any Tests Failed  ·  Run Keyword If Test Failed  ·  Run Keyword If Test Passed  ·  Run Keyword If Timeout Occurred  ·  Run Keyword Unless  ·  Run Keywords  ·  Set Global Variable  ·  Set Library Search Order  ·  Set Log Level  ·  Set Suite Variable  ·  Set Tags  ·  Set Test Message  ·  Set Test Variable  ·  Set Variable  ·  Set Variable If  ·  Should Be Empty  ·  Should Be Equal  ·  Should Be Equal As Integers  ·  Should Be Equal As Numbers  ·  Should Be Equal As Strings  ·  Should Be True  ·  Should Contain  ·  Should Contain X Times  ·  Should End With  ·  Should Match  ·  Should Match Regexp  ·  Should Not Be Empty  ·  Should Not Be Equal  ·  Should Not Be Equal As Integers  ·  Should Not Be Equal As Numbers  ·  Should Not Be Equal As Strings  ·  Should Not Be True  ·  Should Not Contain  ·  Should Not End With  ·  Should Not Match  ·  Should Not Match Regexp  ·  Should Not Start With  ·  Should Start With  ·  Sleep  ·  Variable Should Exist  ·  Variable Should Not Exist  ·  Wait Until Keyword Succeeds

 

2)自定义测试库

 

4、Web自动化测试

 

Robot Framework框架下进行web自动化测试可使用Selenium2Library库来进行

 

Selenium2Library中常用的关键字分类:

-- browserManagement

OpenBrowser

Close Browser

Go to

Go back

 

-- Cookie

addcookie

deletecookie

deleteall cookies

getcookies

getcookie value

 

-- Elements

控件操作相关的关键字

 

-- JavaScript

executeJavaScript

executeasync JavaScript

 

-- sceenshot

capturepage screenshot

 

-- waiting

wait forcondition

waituntil page contains

waituntil page contains element

 

5、C/S自动化测试

 

Robot Framework框架下进行C/S自动化测试可使用AutoItLibrary库来进行

 

关键字:

-- Window操作

-- Control操作

-- Mouse操作

-- Process操作

-- Run操作

-- Reg操作

 

6、数据库自动化测试

 

Robot Framework框架下进行数据库自动化测试可使用DatabaseLibrary库来进行

 

关键字:

-- connect to database:链接数据库,标准链接

-- connect to database using custom params:使用自定义参数链接数据库

-- disconnect from database:断开数据库

-- query:查询数据库,可用list变量接收返回结果

-- row count:查询sql语句的结果条目数,这里用query也能完成

-- execute sql script:执行sql文件,sql文件中是sql的脚本语句

-- execute sql string:执行sql脚本

 

7、接口自动化测试

 

Robot Framework框架下进行接口自动化测试可使用requestsLibrary库来进行

 

关键字:

-- Create Session:创建一个session,连接某个服务器

-- Create Ntlm Session:创建一个session,并加上域、用户名、密码用于NTLM认证

-- Get Request:通过Get方式发起请求

-- Post Request:通过Post方式发起请求

-- Head Request:发送一个HEAD请求

-- To Json:将文本转换成json对象

 

8、移动自动化测试

 

Robot Framework框架下进行移动自动化测试可使用appiumLibrary库来进行

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值