Generate a dynamic data rule

Automatically generate a dynamic data rule to include dynamic data functions, such as relative dates, based on learned or imported data.

Overview

Service Virtualization can examine and analyze the data in your data model to find connections between request, response, and service call activity fields. SV then creates a new rule that uses the SV dynamic data functions to automatically generate dynamic data for use during simulation.

For example, you may need to correlate request and response data based on a request ID. The dynamic data rule will be set up to automatically copy the ID from the request to the response using the Copy from function.

For more details on dynamic data functions, see Rule Functions.

How it works

Service Virtualization analyzes the relationships found between input and output data in learned or imported messages, and then uses this information to set up the dynamic data functions in the new rule. This enables the new rule to simulate the behavior of the original service.

If the analysis finds more than one potential match for a field, Service Virtualization picks the best match. Alternative options are presented, enabling you to consider the options and make your own choice.

For a virtual service with multiple operations, the dynamic data analysis is run on all operations, and creates one comprehensive rule. The results are customized for each operation as needed.

The dynamic data rule is created with a higher rule priority than the rule it was generated from. For details on rule priority, see Data Model Editor and The Simulation Process.

Feature availability

A dynamic data rule can be generated from any data rule except for a scripted rule, as it does not contain any data.

The resulting dynamic data rule is either a Data Rule or a C# scripted rule.

  • The C# scripted rule is more versatile.
  • Array data inside a Data Rule is not supported.

Supported data functions include: Copy from, Set, Substring, Set date/time relative to and Set relative date/time

Back to top

Prerequisites

Enable the Dynamic Data early access feature. For details, see Early access features.

Back to top

Generate dynamic data

  1. In the Data Model Editor, create a new rule or open an existing rule.

    Note: For complex scenarios, create and generate a separate data rule for each message type.

    Make sure that the first row of the source rule contains the required message type, as the first row determines the message type used to generate the dynamic data rule.

  2. Import data or record real service behavior to populate the rule.

  3. Right-click the rule header and select Generate dynamic data.

  4. In the Generate Dynamic Data dialog box, fill in the details:

    Rule Name Enter a name or accept the default.
    Rule Type

    Select a rule type.

    Note: Dynamic data inside an array is not supported in a Data Rule. To use the Generate Dynamic Data functionality for array data, use a C# scripted rule.

    When you click OK, Service Virtualization analyzes the data in the rule and generates a new rule with preset dynamic data functions.

  5. Review the generated rule and modify as needed. By default all fields in this rule, except for the fields that have been set up to use dynamic data generation, will be set to Ignore. For a C# rule, there is no code generated for those fields.

    If the analysis finds more than one potential match for a field, Service Virtualization picks the best match. Alternative options are displayed in the field under Dynamic Data Proposals in a Data Rule, or in comments in a Scripted rule.

Back to top