10 June 2009 - 3.0-beta-2 user guide eclipse intellij netbeans maven download nightly forum bugs blog sf.net eviware


Eviware Logo

MockResponse Step

The MockResponse Test step listens for a SOAP Request and returns a pre configured response before moving on. The incoming request can be validated just as the response of a TestRequest Step with the same configurable assertions.

Usage scenarios for this TestStep are for example:

  • Client testing - validating incoming requests and returning dummy or incorrect responses to test a client?s behavior
  • Testing of asynchronous processes - for example starting some kind of job with an initial RequestStep and then waiting for a notification before moving on

Creating MockResponse Steps

MockResponse steps can be created either "from scratch" using one of the TestCase or TestStep Insert or Add operations;

New Simulated SOAP Response in soapUI Pro

The dialog contains the following options:

  • Name - The name of the created step
  • Operation - Specifies which operation to mock
  • Interface - Specifies which interface to mock, changing this will also update the list of available operations
  • Create Response - if a default MockResponse message should be created from the schema
  • Port - the port to listen on
  • Path - the path to listen on

After setting the desired values and selecting OK, the step will be created and its editor opened.

Other ways to create a MockResponse Step are:

  • From an Operation Nodes' right-click menu to create a MockResponse step for that Operation

    Add Simulated SOAP Response in soapUI Pro from operations node

  • From a Request Nodes' right-click menu to create a MockResponse step for that Request, using the last response as the MockResponse content (if available).

    Add Simulated SOAP Response in soapUI Pro from response

  • From a MockResponse Nodes' right-click menu to add it to a TestCase, using the existing MockResponse content (if available).

    Add Simulated SOAP Response in soapUI Pro from existing MockResponse content

MockResponse Step Properties

The bottom-left properties are the same as for a standard MockResponse with the following exceptions:

  • Timeout - Fails the MockResponse Step if no request has been received within the specified number of milliseconds. Specifying 0 will wait indefinitely.
  • Handle Fault - tells the MockResponse to accept an incoming SOAP Fault
  • Handle Response - tells the MockResponse to accept an incoming Response Message if it matches the WSDL Operation
  • Start Step - Configures at which step in the TestCase this MockResponse should start "listening" for a request. This can be usefull if you first are making a request to a service that calls back to the MockResponse Step within the execution of that request, in which case you would set the Start Step to the request (otherwise the MockResponse would not be listening for requests when the request comes). Leaving this empty will start listening when the step is executed.
  • Port - the port to listen on
  • Path - the path to listen on
  • Host - the hostname to use in the hosted WSDL

The MockResponse Step Editor

The MockResponse Step is the basically the same as the standard soapUI Pro MockResponse editor with the addition of the same assertions/log tabs in the bottom as the TestRequest editor and a number of context-sensitive wizards in the Outline Editor for creating assertions and Property Transfers.

At the top there is a toolbar that adds input fields for the path and port to listen on during execution, the rest is the same as the MockResponse editor. These are grayed out during execution of the MockResponse step. Assertions can be added/managed just as for the TestRequest editor, the list of available assertions is the same except the SOAP-Fault-related assertions, which are not applicable to request messages.

Edit Simulated SOAP Response in soapUI Pro with the MockResponse editor

Query/Match Configuration

The Query/Match configuration tab allows one to specify a query that will be used to select which incoming request to handle. This is usefull during LoadTests, where requests may come in any order and must be identified using some ID in the request. For example the Query would specify an XPath expression that selects the ID and the Match would contain a property-expansion that would match the ID

Edit Simulated SOAP Response in soapUI Pro with the MockResponse editor

MockResponse Step Execution

When the execution of a TestCase reaches the configured "Start Step", the MockResponse Step will start a local temporary MockService and wait for a request to the configured operation on the configured path and port. Once a request has been received, it will be validated with the configured assertions and processed just like a standard MockResponse. After returning the MockResponse result, the MockService will be closed down. and execution will move to the next step in the TestCase.

Property Transfers can be used with MockResponse Steps just as with TestRequests, i.e. properties can be transferred from incoming requests and to outgoing responses.

Although running a LoadTest containing MockResponse steps will work, these steps are not designed for LoadTesting due to the following:

MockResponse Response Scripts

The context script variable available in the MockResponse Response Script, acts both as a MockRunContext and a TestRunContext, allowing it to access the same context variables as other Groovy scripts in the TestCase


Next: soapUI Pro DataSource Step for data driven testing