johnrix
11 years agoOccasional Contributor
Verifying asynchronous responses for REST services
I'm attempting to use SoapUI 5.0.0 beta to test a RESTful web service which issues asynchronous responses to a supplied Callback URL.
I am able to invoke the service and confirm the initial synchronous response received. I have also created a 'REST MockService' that issues an appropriate response to the callback received from the server, and I supply the endpoint for this as the Callback URL in the initial request.
What I am struggling with though is creating a TestCase that ties the two together such that I can 'expect' the asynchronous callback before proceeding to another test step or passing the test case. I tried adding a 'Mock Response' Test Step to my test case following the initial request. However, this just yields error 'Missing SOAP Operations to Mock in Project'. I took a brief look at the SoapUI source for this error message and discovered the method returning the error appears to be checking if I am using a WSDL interface, which does not make sense for a REST-based API. (Perhaps I am misinterpreting what I saw there though.)
The best hack I've come up with so far is to use scripting to keep track of the currently executing test case as a property of the test suite, and then reference that within the script of the mock service response to decide which test case to execute next. This is ugly though for a wide variety of reasons and makes the test suite almost unmaintainable.
Appreciate any thoughts on how I can improve on this!
Thanks,
John
I am able to invoke the service and confirm the initial synchronous response received. I have also created a 'REST MockService' that issues an appropriate response to the callback received from the server, and I supply the endpoint for this as the Callback URL in the initial request.
What I am struggling with though is creating a TestCase that ties the two together such that I can 'expect' the asynchronous callback before proceeding to another test step or passing the test case. I tried adding a 'Mock Response' Test Step to my test case following the initial request. However, this just yields error 'Missing SOAP Operations to Mock in Project'. I took a brief look at the SoapUI source for this error message and discovered the method returning the error appears to be checking if I am using a WSDL interface, which does not make sense for a REST-based API. (Perhaps I am misinterpreting what I saw there though.)
The best hack I've come up with so far is to use scripting to keep track of the currently executing test case as a property of the test suite, and then reference that within the script of the mock service response to decide which test case to execute next. This is ugly though for a wide variety of reasons and makes the test suite almost unmaintainable.
Appreciate any thoughts on how I can improve on this!
Thanks,
John