Vivendi
Vivendi

Reputation: 21007

Return a certain response in SoapUI

I have created a Mock Service in SoapUI. By default it creates a Request 1 and a corresponding Response 1 in the Mock Service for you.

I can also clone Response 1 and call it Response 2. But when i do a new test request in SoapUI with Request 1, it will then always return Response 1.

So what is the use of cloning Responses? Is there anyway to tell SoapUI that if a request with <ID> == 100, then return Response 1, otherwise return Response 2.

Is this possible? If so, how can i do this?

Upvotes: 1

Views: 7346

Answers (1)

Sebi
Sebi

Reputation: 2584

Double click an operation of your Mock Service. At the bottom left you will see a property called Dispatch. There you can choose how to dispatch your Mock Responses.

If you want to return a certain response for some value in the request you can set up an XPath expression or a Groovy Script to analyze your request.

Have a look at the following tutorial on the soapUI homepage: http://www.soapui.org/Service-Mocking/simulating-complex-behaviour.html

Upvotes: 3

Related Questions