Robotframework-Zoomba是使用機器人框架跨越GUI,REST API和SOAP API自動化的庫集合。這些庫是現有庫的擴展,請求和sudslibrary。
Zoomba為REST和SOAP API添加了大量數據驗證支持,並擴展了典型Web GUI自動化的功能。
當一個團隊開始使用Robot Framework的自動化之旅時 - 我們發現,有一段時間會花一些時間來加速我們的圖書館和Robotframework -Zoomba,旨在使新項目更容易。
有關該功能的更多特定信息,請參見API,SOAP或GUI庫的關鍵字文檔。
示例測試可以在樣本目錄中找到。
在使用不同負載時間的網頁時,您可能會發現自己正在運行很多這樣的電話:
Wait Until Page Contains Element locator
Click Element locator
為了易於使用,我們將其中的許多組合成簡單的一行關鍵字:
Wait For And Click Element locator
Wait For And Click Text text
Wait For And Select From List list_locator target_locator
另一個特別有用的關鍵字是您在等待JavaScript之前在頁面上完成之前完成:
Wait For And Click Element locator that leads to a new page with javascript
Wait Until Javascript Is Complete
Wait For And Click Element locator
該庫包裝了請求庫,因此我們創建了一組關鍵字,以輕鬆允許用戶以單個關鍵字進行請求:
Call Get Request ${ headers_dictionary } endpoint query_string
Call Post Request ${ headers_dictionary } endpoint query_string ${ data_payload }
收到您的數據後,我們非常容易驗證它。驗證響應包含預期的響應,將您的收到的請求與您的預期數據進行比較。如果發現有任何錯誤,它將按線報告它們是什麼。
Validate Response Contains Expected Response ${ json_actual_response } ${ json_expected_response }
如果有任何不匹配的數據,它將看起來像這樣:
Key(s) Did Not Match:
------------------
Key: pear
Expected: fish
Actual: bird
------------------
Full List Breakdown:
Expected: [{'apple': 'cat', 'banana': 'dog', 'pear': 'fish'}, {'apple': 'cat', 'banana': 'mice', 'pear': 'bird'}, {'apple': 'dog', 'banana': 'mice', 'pear': 'cat'}]
Actual: [{'apple': 'cat', 'banana': 'dog', 'pear': 'bird'}]
Please see differing value(s)
如果您想忽略諸如“ update_date”之類的鍵,則只需將'nighored_keys'變量設置為該鍵或鍵列表:
Validate Response Contains Expected Response ${ json_actual_response } ${ json_expected_response } ignored_keys=update_date
Validate Response Contains Expected Response ${ json_actual_response } ${ json_expected_response } ignored_keys= ${ list_of_keys }
使用setup.py
文件在主目錄中輕鬆安裝Zoomba庫。只需運行以下命令以安裝Zoomba及其依賴項:
pip install robotframework - zoomba
如果您決定在本地提取倉庫以做出貢獻,或者只是想播放代碼,可以通過從根目錄中運行以下內容來安裝Zoomba:
pip install .
或者,如果您打算運行單元測試:
pip install .[ testing ]
要訪問庫中的關鍵字,只需將以下內容添加到您的機器人文件設置中(取決於您需要的內容):
** * Settings ** *
Library Zoomba . APILibrary
Library Zoomba . GUILibrary
Library Zoomba . SOAPLibrary
示例測試可以在樣本目錄中找到。
測試目錄還可能包含測試,但請注意,這些目錄用於測試版本,並且可能不像樣品目錄中的那樣直接使用。
為了做出貢獻,請參考貢獻指南。
請參閱腳本的.githooks目錄,以幫助開發。
一般機器人框架問題應直接伸向社區論壇。
有關特定於Zoomba的問題和問題,請在Github上創建一個問題。