Editing a service stub
Service stubs are generated with a single default response for each operation in the WSDL specification. You can edit the service stub to change the default responses or to add conditional responses that can simulate the actual service.To edit the behavior of a service stub:
- In the test navigator, double-click the stub to open the stub editor. Each operation simulated by the stub is represented by an operation element, which contains Case elements that describe a condition. Each case contains a response element. Case elements are similar to test verification points and use the same presentation.
- To change the default response of an operation:
- Expand the operation and the Case : Default element, and then select the response element. The Case : Default element describes the response of the service stub when no other case condition is met.
- Edit the Message content to specify the XML content returned by the service stub.
- To add a conditional response case:
- Right-click the operation and select Add > Equals Case, Contains Case, or Query Case. These conditional case types are similar to the Equals, Contain and Query verification points in service tests.
- Use Equal Case to specify a response that is returned by the stub when the entire incoming message content fully matches the specified message content.
- Use Contains Case to specify a response that is returned by the service stub when a portion of the incoming message content matches the specified message content.
- Use Query Case to specify a response that is returned by the service stub when an XPath query meets the specified criteria.
You can add as many case elements as necessary to simulate the behavior of the original service. Use the Up and Down buttons to change the order in which the case conditions are evaluated. Only the first matching condition is executed.
The default case cannot be removed and is always the last case element in the operation.
- Select the response element and edit the Message content to specify the XML content returned by the service stub. Use the Form, Tree, and Source views to change the XML content display mode.
- Select File > Save or click the Save toolbar button.
What to do next
When you have finished editing the service stub, you can deploy the stub to a stub server.
Related
Service stub overview
Related tasks
Create a service stub Deploying service stubs Add stub servers to a performance schedule