Applies to ReadyAPI 2.2, last modified on November 17, 2017

The Dispatch Style setting specifies which response a virt returns for an incoming request. ReadyAPI offers a number of dispatch strategies for every virtual operation. You can select a dispatch style in the virt editor:

Service virtualization and API testing: Dispatch settings

Click the image to enlarge it.

By default, new operations have the Sequence dispatch style. It means that an operation will return responses, which you defined for it, in series. The Query Match and XPath styles let you select a response depending on the request content. The Parameter style will help you customize the response depending on the parameter values of the incoming request. For detailed information on the available dispatch strategies and their properties, see Dispatching Responses.

What We Are Going to Do

Let’s use the Parameter dispatch strategy and implement the following virt behavior:

  • If an incoming request has these parameters –

    Parameter Value
    response_type code
    client_id 12345

    – then the virt should return the LoginSuccess response.

  • Otherwise, the virt should return the LoginFailed response.

Setting Dispatch Properties

  1. For the Get /login virtual operation, select Parameter from the Dispatch Style drop-down list and click Configure.

  2. Set Default Response to LoginFailed.

  3. Click to add a new rule. This will invoke the Rule Editor.

  4. Set the following values:

    Service virtualization and API testing: Detailed dispatch settings

    Click the image to enlarge it.

  5. Click OK to save the changes.

We have configured the dispatch settings. Now, our virt is ready for running and testing.

Prev          Next

See Also

Creating Your First Virtual Service
Response Dispatching