2017-04-18 42 views
0

我要附加到一个变量,如果字典大小大于1

${queryString}= startOfString 
Run keyword if ${dictionary_size} > 1 
... ${query_string}= catenate ${query_string} restofString 

然而,只有当我可以在Robot中看到的声明就是上面的内容。显然变量赋值不是关键字。有没有这样做,所以我最终会与

startOfString restofString

回答

1

Set Variable If这里是你的朋友的另一种方式。

${queryString}= Set Variable startOfString 
&{dict}= Create Dictionary foo=bar 
${dictLen}= Get Length ${dict} 
${queryString}= Set Variable If ${dictLen} > 1 ${queryString} restofString ${queryString} 

如果查询的开始是静态的:

&{dict}= Create Dictionary foo=bar zaz=lop 
${dictLen}= Get Length ${dict} 
${queryString}= Set Variable If ${dictLen} > 1 startOfString restofString startOfString