自動テストフレームワークRF ---可変

1。$ {スカラー}

 

 

2。@ {list}

*** Test Cases ***
创建列表并赋值
    # 创建一个空列表
    ${list1}    create list
    log to console  ${list1}

    # 为列表赋值
    FOR    ${item}    IN RANGE    10
    run keyword if  $item%2==0
    ...     append to list   ${list1}   ${item}
    END

    # 打印列表
    log to console  ${list1}


通过索引删除列表元素
    # 创建一个列表
    ${list1}    create list  a  b   c   d
    # 打印列表
    log to console  ${list1}
    # 从列表删除元素:按照索引,从0开始计算
    remove from list  ${list1}     2
    # 打印列表
    log to console  ${list1}

演算結果:

 

3。&{dict}

创建字典并赋值
    # 创建字典并赋值
    ${dict1}    create dictionary    a=1    b=2     c=3    name=test
    log to console  ${dict1}


字典操作
    # 创建字典并赋值
    ${dict1}    create dictionary    a=1    b=2     c=3    name=test
    log to console  ${dict1}
    # 添加键值对或者更新键值
    set to dictionary  ${dict1}     age=18      a=100
    # 打印字典
    log to console  ${dict1}
    # 删除字典键值对
    remove from dictionary  ${dict1}    a
    # 打印字典
    log to console  ${dict1}

演算結果:

 

おすすめ

転載: blog.csdn.net/qq_19982677/article/details/108654192