首页 > 其他 > 详细

RF--evaluate关键字

时间:2020-07-09 00:55:51      阅读:149      评论:0      收藏:0      [点我收藏+]

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)

 

RF--evaluate关键字

原文:https://www.cnblogs.com/guang2508/p/13270048.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!