RobotFramework基本语法----字典

发布时间 2023-06-10 19:48:39作者: 飞虎就是我

字典创建

&{dict} = run keyword if '${result}'=='on' Create Dictionary boardtype=${BoardType_list}[${j}] shelfid=${Shelf_list}[${j}] slotid=${Slot_list}[${j}]

将上述字典一个个插入到列表中

run keyword if '${result}'=='on' append to list ${onlineboard_list} ${dict}
获取online的board信息
[Documentation]
[Arguments] ${device}
[Return] ${onlineboard_list}
${onlineboard_list} Create List
${length} Get Length ${BoardType_list}
${board_info_result} Execute Command On ZXR ${device} command=show board-info
${i} set variable 0
FOR ${j} IN RANGE 0 ${length}
${result} 获取设备板卡信息 output=${board_info_result} board_name=${BoardType_list}[${j}] shelf=${Shelf_list}[${j}] slot=${Slot_list}[${j}] get_info=online
&{dict} = run keyword if '${result}'=='on' Create Dictionary boardtype=${BoardType_list}[${j}] shelfid=${Shelf_list}[${j}] slotid=${Slot_list}[${j}]
run keyword if '${result}'=='on' append to list ${onlineboard_list} ${dict}
END