• RF--evaluate关键字


    evaluate后面的参数为condition,和should be true一样,详情请看rf--基础中的should be true

    evaluate作用为执行后面的python表达式赋值给前者

    ${var}    set variable    ${890}

    完全可以写成

    ${var}    evaluate    890

    复杂的表达式:

    *** Test Cases ***
    case1
        ${alist}   evaluate    ['hello']*3
        log to console   ${alist}
    结果:
    ['hello', 'hello', 'hello']
    *** Test Cases ***
    case2
        ${alist}   evaluate    [i for i in range(10)]
        log to console   ${alist}
    结果:
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    *** Test Cases ***
    case3
        ${alist}   evaluate    [i for i in range(10)]
        ${alist}    evaluate  $alist[:5]    #evaluate作用为执行后面的python表达式,后面的参数类似should be true
        log to console   ${alist}
    结果:
    [0, 1, 2, 3, 4]

    evaluate后面不能带 =

    *** Test Cases ***
    case4
        ${alist}   evaluate    [i for i in range(10)]
        ${alist}    evaluate  $alist[0]=9    #evaluate后的参数类似should be true
        log to console   ${alist}
    结果报错:
    Evaluating expression 'RF_VAR_alist [0 ]=9' failed: SyntaxError: invalid syntax (<string>, line 1)
  • 相关阅读:
    RK3399之时钟
    C之{}注意点
    ARM之不用段寄存猜想
    linux驱动之入口
    android之HAL
    git
    消息中间之ActiveMQ
    Maven之阿里云镜像仓库配置
    清理Oracle临时表空间
    Tomcat控制台日志输出到本地文件
  • 原文地址:https://www.cnblogs.com/guang2508/p/13270048.html
Copyright © 2020-2023  润新知