我是robot框架的新手,通过robot框架从事rest web服务测试自动化的工作。我的经理建议我通过机器人框架自动化SOAPUI,我发现了一个库,即使是下面给出的这个库似乎也没有很好的文档。即使在库中给出的示例也更具体于基于SOAP的web服务,我正在寻找通过soapui自动化而不是基于SOAP的web服务进行rest web服务测试。https://github.com/pavlobaron/robotframework-soapuilibrary
因此,请推荐我通过robotframework中的SOAPUI自动化来实现rest rest服务测试自动化。
另一种方法是通过robotframework实现rest welll服务测试自动化,而不需要soapui tool.ssome和可用的robotframework文档库。
有没有人能向我推荐上面两个关于rest webservice的robotframework测试自动化的解决方案。
发布于 2014-04-21 00:21:43
为了测试RESTful服务,您可以使用Requests库。该库的主页是https://github.com/bulkan/robotframework-requests/
为了测试SOAP服务,您可以使用Suds库。该库的主页是https://github.com/ombre42/robotframework-sudslibrary
在robotframework主页上可以找到这两个链接以及其他许多链接。这里有一个快速链接:
http://robotframework.org/#test-libraries
下面是一个连接到RESTful服务的示例,它验证它返回的状态代码是否为200,以及JSON数据是否具有某些特定的键(请注意,此测试在我编写它的时候通过了,但是如果API在我编写它的时间和您读取它的时间之间发生了变化,它可能会失败)
*** Settings ***
| Library | RequestsLibrary
| Library | Collections
*** Variables ***
| ${SERVICE_ROOT} | http://api.openweathermap.org
| ${SERVICE_NAME} | openweathermap
*** Test Cases ***
| Example RESTful API test
| | [Documentation] | Example of how to test a RESTful service
| |
| | Create session | ${SERVICE_NAME} | ${SERVICE_ROOT}
| | ${response}= | Get | ${SERVICE_NAME} | /data/2.5/weather?q=chicago,il
| |
| | Should be equal as numbers | ${response.status_code} | 200
| | ... | Expected a status code of 200 but got ${response.status_code} | values=False
| |
| | ${json}= | To JSON | ${response.content}
| | :FOR | ${key} | IN
| | ... | coord | sys | weather | base | main | wind | clouds | dt | id | name | cod
| | | Run keyword and continue on failure
| | | ... | Dictionary should contain key | ${json} | ${key}
| | | ... | expected json result should contain key '${key}' but did not发布于 2018-05-23 02:52:25
这是我关于如何集成SoapUI和RF的博客:http://qatesterblog.blogspot.com/2018/04/integrating-soapui-into-robot-framework.html
总而言之:
XML关键字使用开关运行每个测试用例:-rMI
https://stackoverflow.com/questions/23034595
复制相似问题