RF的Collections标准库

Collections:针对List和Dict的处理
想看更为全面的可以参考官网:http://robotframework.org/robotframework/latest/libraries/Collections.html

可以添加Append to list和移除Remove From List和创建Set List Value
*** Settings ***
Library   Collections

*** Variables ***
&{dict2}    id=1
&{dict3}    id=2
*** Keywords ***
getappendlist
    ${str1}  create list
    Append to list  ${str1}  ${dict2}  ${dict3}
    log to console  ${str1}
getsetlist
    ${str2}  create list
    Append to list  ${str2}  1   2   3
    #修改list中的值
    Set List Value   ${str2}   1    b
    Set List Value   ${str2}   -1    c
    LOG TO CONSOLE   ${str2}
getremovelist
    ${str3}  create list
    Append to list  ${str3}  4   5   8
    log to console  ${str3}
    ${x}  remove from list  ${str3}    1
    log to console  ${str3}
*** Test Cases ***
case1--列表追加
    getappendlist
case2--列表修改
    getsetlist
case3--列表根据下标删除
    getremovelist
 
 

猜你喜欢

转载自www.cnblogs.com/Lara1798/p/12951038.html
RF