查询返回列表列表-外部列表是查询返回的行列表,内部列表是列列表。即使查询在单个行中返回单个列,也会出现这种情况。可以使用robot的嵌入变量语法来引用所需的值:
${Response_Location}= Rest.get http://sampleurl/sample/locations/${Get_LocationId[0][0]}
下面是一个完整的例子来说明两者的区别。我在模拟数据
@{Get_LocationId}
这样测试就不需要实际的数据库连接。
*** Test Cases ***
Example
${Get_LocationId}= evaluate [('somekindofIdhere',)]
should be equal as strings ${Get_LocationId} [('somekindofIdhere',)]
should be equal as strings @{Get_LocationId}[0] ('somekindofIdhere',)
should be equal as strings ${Get_LocationId[0]} ('somekindofIdhere',)
should be equal as strings ${Get_Locationid[0][0]} somekindofIdhere