默认情况下,变量是Robot中的字符串.
因此,您的前两个语句是将“xx,yy”等字符串分配给您的vars.
然后“评估”只是像Python那样执行你的语句.
因此,使用逗号添加两个字符串将生成一个列表:
$python
>>> 1,2+3,4
(1, 5, 4)
所以你应该使用${}和使用number variables. (点)用于分隔符,如下例所示:
*** Test Cases ***
sum of variables
${calculatedTotalPrice} = set variable ${42.42}
${productPrice1} = set variable ${43.15}
${calculatedTotalPrice} = Evaluate ${calculatedTotalPrice}+${productPrice1}
log to console ${calculatedTotalPrice}
这将产生:
$pybot test.robot
==============================================================================
Test
==============================================================================
sum of variables ...85.57
==============================================================================