robot framework 容器 字典

2021-10-06 06:54:20 字數 1693 閱讀 2786

$=

1.建立乙個容器,關鍵字create dictionary,來自builtin庫

&create dictionary

key1

value1

key2

value2

&create dictionary

key1=value1

key2=value2

2.兩個字典是否相等,關鍵字dictionaries should be equal,來自collections庫,如果不等,這個關鍵字失敗

dictionaries should be equal &&

3.字典包含某個key,關鍵字dictionary should contain key,來自collections庫,如果不包含,關鍵字失敗。如果不包含某個key,關鍵字則dictionary should not contain key

dictionary should contain key

&key1

4.字典包含某個value,關鍵字dictionary should contain value,來自collections庫,如果不包含,關鍵字失敗 ,如果不包含某個value,關鍵字則dictionary should not contain value

dictionary should contain value

&value1

5. 將字典的轉化為list,關鍵字get dictionary items,預設key在轉化過程中會自動排序,來自collections庫

$get dictionary items

$sort_keys=false

6.將字典中的key值轉化為list,關鍵字get dictionary keys,預設key 在轉化過程中自動排序,來自collections庫

$get dictionary keys

$sort_keys=false

7. 將字典中的value值轉化為list,關鍵字get dictionary values,預設values在轉化過程中自動排序,來自collections庫

get dictionary values$

8.根據給定key獲取對應value,關鍵字get from dictionary,來自collections庫

$get from dictionary$a

9.保留給定key,從而刪除所有其他key 及對應的value,關鍵字keep in dictionary,來自collections庫

$keep in dictionary$a

c 10.彈出某個給定key對應的value並在原字典中刪除給定key和對應value,關鍵字pop from dictionary,來自collections庫,下列結果為$=2,    $=

$pop from dictionary$b

11.移除給定的key及對應的value,關鍵字remove from dictionary,來自collections庫,下列結果為: $=

remove from dictionary$b

c 12.往字典中追加key 和value,關鍵字set to dictionary,來自collections庫,下列結果為$=

set to dictionary$d

4xe$set to dictionary

$d=4x

e=$

我的部落格主頁: 

RobotFramework測試Rest服務

python有乙個都對http請求封裝的很好的類庫 requests 見這裡 而rest服務就是基於http請求之上的,活躍的社群也有提供了乙個封裝 robotframework requests 見這裡 可以用來方便的測試rest服務 這裡記錄下在使用過程中碰到的問題 1.import的時候,名字...

RobotFramework 資料分離

robotframework 資料分離分為三種 1.run 新增引數 2.外部的python檔案 3.讀取excel run 新增引數 適用於jenkins 使用 v 引數名 引數值 使用外部的python檔案 使用外部的python檔案進行資料分離的話,首先建乙個python檔案,並在裡面定義乙個...

robot framework環境搭建

一 robot framework環境搭建 官網 序號安裝包名 安裝方法備註1 python exe檔案,直接雙擊安裝 一切的基礎,安裝路徑不能有空格 2setuptools python 的套件管理程式 3pip 1 cmd進入ez setup.py檔案目錄 2 用setuptools安裝 eas...