美文网首页
robot framework系列学习笔记-基础关键字(高级用法

robot framework系列学习笔记-基础关键字(高级用法

作者: hello_dong2015 | 来源:发表于2019-08-18 14:38 被阅读0次
  • if语句
    通过"run keyword if"关键字可以编写if分支语句,需要注意else if和else前面的三个点点点(...)
    *** Test Cases ***
    test case
    ${a} Set Variable 59
    run keyword if ${a} >=90 log 优秀
    ... ELSE IF ${a} >=70 log 良好
    ... ELSE IF ${a} >=60 log 及格
    ... ELSE log 不及格
  • for循环
    编写循环通过":FOR"
    1.循环0~9
    *** Test Cases ***
    test case
    :FOR ${i} IN RANGE 10
    \ log {i} 2.遍历列表 *** Test Cases *** test case @{abc} create list a b c :FOR \{i} @{abc}
    \ log ${i}
  • 强大的Evaluate
    1.生成随机数
    在robot framework中使用"Evaluate"可以调用python所提供的random模块下的randint()方法.
    *** Test Cases ***
    test case
    ${d} Evaluate random.randint(1000,9999) random
    log ${d}
    2.调用自己编写的python程序
  • 注释
    "Comment"和"#"两种方式
    *** Test Cases ***
    test case
    Comment 这是注释
    #这也是注释 (markdown语法中,#表示一级标题,前边加上\是为了格式显示正确)

相关文章

网友评论

      本文标题:robot framework系列学习笔记-基础关键字(高级用法

      本文链接:https://www.haomeiwen.com/subject/wsprsctx.html