Hybrid simulation allows you to simulate a specific portion of the communication between system under test and the real system.
Hybrid Simulation Overview
In certain testing scenarios, you may not be able to or want to simulate all of the communication from the system under test to the real service. For example, if the real service is very complex, or if it is maintained by a third party and you do not know all of its responses, you may only want to virtualize the responses that are known to you.
By default, if the system under test sends a request that the virtual service does not recognize, it responds with the Default response, which contains dummy data. This data can affect your testing.
Hybrid Simulation lets you fall back to the real service in cases where the request data is not recognized by the virtual service. Instead of sending a response with dummy data, the true response is sent from the real service.
In the Data Model editor, once enabled, the Hybrid Simulation feature lets you indicate for each request, whether to use the simulated response or whether to forward the request to the real service and send back the true response.
In this way, you can prepare your virtualized service step by step per operation, and use the real service for the parts of the system that you do not yet have or understand.
In addition, even for a particular request for which the response could be simulated, you can still forward the request to the real service if needed.
Set up Hybrid Simulation
To set up hybrid simulation:
- Click the Advanced Simulation toolbar button and click Hybrid Simulation.
Open the relevant rule as per your requirements. The Request Handling column is added.
In the Request Handling column, select Simulate to use the learned response or known data. Select Forward to use the response from the real service. Repeat for each row.
Tip: To apply a behavior to all rows, click the link in the upper right corner of the rule header.
Tips and Guidelines
- Hybrid simulation is not available for all the protocols. Additional protocols will be supported in coming versions. Certain protocols by design, cannot support hybrid simulation.
- To set the Request Handling from a scripted rule or from data driving, use the ForwardToRealService property and set it to true or false.
- The Simulation report indicates whether a response was simulated or obtained from the real service.
- On the virtual service Overview page, click the Information button adjacent to Service State symbol to see how many requests were forwarded to the real service.
- Requests which do not belong to any known operation, will be always forwarded to the real service once you enable the Hybrid Simulation feature.