3
votes

I am new to robot framework and working on rest web service testing automation through robot framework. My manager suggest me to automate SOAPUI through robot framework, i found one library, even this library given below does't seems to be well documented. Even example given in library is more specific to SOAP based web service , i am looking for rest web service testing through soapui automation not soapbased webservices. https://github.com/pavlobaron/robotframework-soapuilibrary

So please suggest me on rest webservice testing automation through SOAPUI automation in robotframework.

Another approch is rest webservice testing automation through robotframework without soapui tool.ssome welll document library available http://peritus.github.io/robotframework-httplibrary/HttpLibrary.html

Could anyone suggest me on above two solution on robotframework testing automation for rest webservice.

2

2 Answers

5
votes

For testing RESTful services you can use the Requests library. The home page for this library is https://github.com/bulkan/robotframework-requests/

For testing SOAP services you can use the Suds library. The home page for this library is https://github.com/ombre42/robotframework-sudslibrary

Links to both of these, and many others, are available on the robotframework home page. Here's a quick link:

http://robotframework.org/#test-libraries

Here is an example that connects to a RESTful service and verifies that it returns a status code of 200, and that the JSON data has some specific keys (note that this test passes at the time that I wrote it, but if the API changes between the time I wrote it and the time you're reading this, it may fail)

*** 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
1
votes

This is my blog about how I integrate SoapUI and RF: http://qatesterblog.blogspot.com/2018/04/integrating-soapui-into-robot-framework.html

In summary:

  1. One keyword run each test case by testrunner ith switch: -rMI
  2. The XML report is processed using XML library. If it finds the case is "Finished", that means a Pass. If not, will capture the failure message and throw a FAIL