The Simulation Process
During simulation, a client, such as your AUT, sends a request, and the virtual service must respond. As client requests come in, Service Virtualization creates simulation responses based on the data model defined for the virtual service.
A virtual service contains at least one data model, which defines the functional behavior that the virtual service supplies during simulation. You can manually customize data models, or put the virtual service in Learning mode to record real service behavior. This learned data is then added to the virtual service's model, for use during simulation. For more details, see Data modeling.
Overview
The data model includes:
- operations, as described in the virtual service description
- rules within the operations, that define data behavior for each operation in the service
- conditions, that define the specific message data that must match the rule, and
- actions, that define the virtual service response for specific requests
Service Virtualization creates a response based on the rules in the particular operation. All rules have exactly the same structure (data columns) and are ordered by priority, with the highest priority rule at the top.
Each rule contains a set of condition and action functions. Service Virtualization uses condition functions to select a data row from every rule that matches the request. As a result, at most, one data row is selected from each rule. You define the functions you want to use for each data column.
Then, Service Virtualization uses action functions from matching rules to formulate the response, resulting in a response that may be compiled from parts of different rules. One part of a response may come from one rule, with other parts coming from other rules. If two rules want to write to the same column, then the rule with the higher priority, that is higher in the list, determines the response.
Simulation step-by-step
Service Virtualization evaluates an incoming request as follows:
Click a box for more information or see below.
Service Virtualization examines the first rule in the data model, the highest priority rule. If the request data matches the conditions of one of the rows in the rule, Service Virtualization starts to compile the response.
Service Virtualization uses the matching row to start to compile the service response, by performing the rule's Action functions, and executing Service Call Activity.
Perform the rule's Action functions
When the request data matches a row in the rule, the rule's Action functions are performed (such as Set or CopyFrom). The parts of the message that were not yet written to, or were written by a lower priority rule only, are filled. Data written by a rule with a lower priority may be overwritten by a rule with a higher priority.
If Service Call Activity is defined in the data model, and was not yet executed, and its request is fully defined, it is executed now. The response is stored in the Service Call Activity response column.
Are there more rules in the data model?
If there are additional, lower priority rules in the data model, Service Virtualization continues to the next rule, and starts the evaluation process again.
After all the rules were processed, were changes made to the response?
If at least one of the rules modified a part of the response, Service Virtualization goes over the rules again, starting with the first, highest priority rule. If something has changed, one of the rules which may not have matched the request data may now match. This can cause a change in the response.
Send the response to the client
When there are no additional rules to evaluate, and no changes were made to the response on the last pass through the rules, the response is complete. The virtual service returns the response to the client.
See also:
- To learn more about customizing virtual service behavior to meet your needs, see Data modeling.
- For task details, see Modify Virtual Service Behavior.