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)