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上创建一个问题。