Ride基本使用

基本使用步骤:

  • 创建项目(New Project)
  • 创建模块(New Directory)
  • 创建测试套件(New Suite)
  • 创建测试用例(New Test Case)
  • 创建资源文件(New Resource)
  • 创建业务关键字(New User Keyword)
  • 常用关键字用例编写
  • robot报告显示

在这里插入图片描述

  1. 创建项目(New Project)

File --> New Project,Type选择Directory,Format选择Robot
在这里插入图片描述

  1. 创建模块(New Directory)
    鼠标右键点击项目 --> 选择New Directory
    在这里插入图片描述
  2. 创建测试套件(New Suite)
    鼠标右键点击模块 --> 选择New Suite
    在这里插入图片描述
  3. 创建测试用例(New Test Case)
    鼠标右键点击Suite --> 选择New Test Case
    在这里插入图片描述
  4. 创建资源文件(New Resource)
    资源文件是【自定义关键字】的载体
    注意:只能在文件夹下面进行创建,并且是txt格式的
    在这里插入图片描述
  5. 创建业务关键字(New User Keyword)
    在资源文件下新建业务关键字
    在这里插入图片描述
  6. 常用关键字用例编写
    以下这些都是robot常用关键字,但其实我们自己的项目中进行UI/App自动化时,我们一般会使用自定义关键字
    在这里插入图片描述
testcase003
    Comment    1、打印
    Log    你好
    Comment    2、设置变量
    ${a}    Set Variable    100Log    ${a}Comment    3、获得系统时间
    ${time}    Get TimeComment    4、睡眠时间,强制等待
    Comment    sleep    3Comment    5、字符串的拼接
    ${str}    Catenate    oracle    mysql    sqlserver
    Log    ${str}Comment    6、创建列表
    ${list1}    Create List    11    22    33Log    ${list1}
    @{list2}    Create List    44    55    66LogMany    @{list2}Comment    7、创建字典
    ${dic}    Create Dictionary    name=mikasa    age=17Log    ${dic}
    ${keys}    Get Dictionary Keys    ${dic}Log    ${keys}
    ${values}    Get Dictionary Values    ${dic}Log    ${values}
    ${key_value}    Get From Dictionary    ${dic}    name
    Log    ${key_value}Comment    8、执行python里面的方法
    ${random_num}    Evaluate    random.randint(1,101)    modules=random
    Log    ${random_num}
    ${time}    Evaluate    time.time()    modules=time
    Log    ${time}Comment    9、用自定义的方法
    Import Library    D:/Users/**/PycharmProjects/PythonProject0329/base.py
    ${a}    Set Variable    mi
    ${b}    Set Variable    hongguang
    ${return_result}    join_two_strings    ${a}    ${b}Log    ${return_result}Comment    10、流程控制IF
    ${score}    Set Variable    62Run Keyword If    ${score}<60    Log    不及格
    ...    ELSE IF    60<=${score}<=80    Log    良好
    ...    ELSE    Log    优秀
    Comment    11、流程控制ForFOR    ${a}    IN    MYSQL    ORACLE    JAVALog    ${a}ENDComment    12、For遍历数组
    @{list3}    Create List    MYSQL    ORACLE    JAVAFOR    ${a}    IN    @{list3}Log    ${a}ENDComment    13、For遍历数字范围
    FOR    ${a}    IN RANGE    1    10Run Keyword If    ${a}==5    Exit For LoopLog    ${a}END

base.py
实现字符串拼接

def join_two_strings(arg1, arg2):return arg1 + "-" + arg2
  1. robot报告显示:
    在这里插入图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值