When creating a functional TestCase in soapUI, a common scenario is that you want to call some REST Resource and validate its response to check that the correct result is returned. This can be easily achieved:
- Add a REST Request TestStep to a new or existing TestCase
- Add Assertions to the TestStep that validate the response message
Adding the Request TestStep can be done in several ways:
- By pressing the “Add to TestCase” button on the top left of the message editor or the “Add to TestCase” action from the Request Popup Menu. This will prompt for which TestSuite/TestCase to add to (or create new ones) and then open the following dialog:
- By pressing the REST Request button or selecting the corresponding “REST Test Request” option from the Insert/Append TestStep popup menu options in the TestCase editor. This will first prompt for a name and which REST Method to test:
The drop-down shows all REST Requests and their corresponding Methods, select which you want to use as a starting point for your TestStep.
In either ways, pressing OK generates the REST Request TestStep as specified into the target TestCase:
Double-click it to open the editor which looks exactly like the standard REST Request editor apart from the Assertion and Log tabs added at the bottom:
An overview on how to work with assertions is available at..., currently there are no REST-specific assertions, the standard assertions for response messages and XML (see …) all apply as usual.
Add assertions as desired and you are all set. Of course you can add any number of SOAP TestSteps to a TestCase, chaining them as desired and transferring values between response and request messages with the Property-Transfer TestStep (see ...)