zoukankan      html  css  js  c++  java
  • RF--基础

    常用关键字:

    ${var}  set variable  hello world  #${var}为变量的常用书写格式,set variable设置变量,均为字符串

    ${var2}  set variable  hello world  #${var}为变量的常用书写格式,set variable设置变量,均为字符串

    log to console  ${var}  #会输出到控制台

    log  ${var}  #不会输出到控制台,会输出到日志里

    sleep  1  #默认单位为秒s,可以设置其他单位1d,2h,3m,4s,5ms,例sleep 5ms

    should be equal  ${var}  hello world  #判断

    should contian  ${var}  hello  #断言${var}中是否包含hello

    should be true  'hello word'==$var  #这里把  'hello word'==$var  看成一个字符串表达式,当${var}为字符串时,在should be true调用时会省去引号

    should be true注释:

    *** Test Cases ***
    case1:
        ${var}  set variable  hells
        should be true  hello == ${var}
    结果:FAIL
    Evaluating expression 'hello == hells' failed: NameError: name 'hello' is not defined
    此次报错信息为hello未定义,在python中字符串hello应写为'hello'
    
    case2把hello改为'hello',此处变量依旧用hells是为了体现是变量错误
    *** Test Cases ***
    case2:
        ${var}  set variable  hells
        should be true  'hello' == ${var}
    结果:FAIL
    Evaluating expression ''hello' == hells' failed: NameError: name 'hells' is not defined
    报错信息为'hells'未定义,在rf中的should be true比较中,调用字符串变量时,直接取引号''内部的数据
    
    *** Test Cases ***
    case3:
        ${var}  set variable  hello
        should be true  'hello' == '${var}'
    结果:PASS
    直接在调用的字符串变量外部加引号来弥补本身调用的问题
    
    *** Test Cases ***
    case4:
        ${var}  set variable  hello
        should be true  'hello' == $var
    结果:PASS
    另一种书写方式,在should be true中, 加引号'${var}'和去大括号$var代表的意思相同
    
    *** Test Cases ***
    case5:
        ${var}  set variable  [1,2]
        should be true  '[1,2]' == $var
    结果:PASS
    在遇到变量不是字符串格式时,依旧如同case4的格式书写
  • 相关阅读:
    Android开发之JSON数据发送与获取
    Layouts之TableLayout表格布局
    Layouts之GridLayout网格布局
    Android WiFi模块学习
    关于Fragment的讲解及适配
    hive 压缩全解读(hive表存储格式以及外部表直接加载压缩格式数据);HADOOP存储数据压缩方案对比(LZO,gz,ORC)
    Dynamics CRM SQL转化为FetchXML的在线转化工具
    Dynamics CRM 通过Odata创建及更新记录各类型字段的赋值方式
    shell命令执行hive脚本(hive交互,hive的shell编程)
    CRM 2013 Script Loading Deep Dive
  • 原文地址:https://www.cnblogs.com/guang2508/p/13258413.html
Copyright © 2011-2022 走看看