In this section:
Modifying Data Structures
Different testing scenarios may require the data to be structured in a variety of ways. The data modeling feature enables you to modify data structures that you can use in all of your testing scenarios.
Duplicating Record Types
You can duplicate a record type and its members/keys, including all their properties (constraints, mask, and generation settings).
- Choose Duplicate Record Type from the record type ellipsis menu.
- Specify a name when prompted and click Save.
Deleting Record Types
Choose Delete Record Type from the record type ellipsis menu to delete it.
Adding and Deleting Members
You can add members to record types within a data set.
- Choose a record type and click the Add Member button (+).
- Specify a name for the new member and choose a type from the drop-down menu. You can add a primitive, a list of primitives, or record type as a member of the selected record type (see Data Modeling for information about types of members).
- Choose a data generation mode for the new member. See Mask and Generation Mode Settings for details.
- Configure the mode settings and click Create.
To delete a member from the model, choose Delete Member from the member's ellipsis menu.
Setting Properties
Properties define the kind of interactions you can perform with your members and keys in your data set. Generation and mask settings and data constraints are kinds of properties that are added when you infer constraints or generate data.
- Click on a record type and choose Add New Property from the key's or member's ellipsis menu.
- Define the property in the field that opens.
- Changes are automatically saved when you click away.
To remove a property:
- Open the Remove Property menu.
- Click the trash icon.
Generating Data
You can generate data for members and keys within your data set. Data is generated according to the Mask and Generation Settings.
- Click on a record type and choose Mask and Generate Settings from the member's or key's ellipsis menu.
- Choose a mode from the drop-down menu.
- The mode determines how the data is generated. Each mode has different options. See Mask and Generation Mode Settings for details.
- Configure the mask and settings for the type you selected and click Save.
- Click Generate Data in the toolbar.
- Specify a name for the generated repository, choose the number of records to generate, and select which data sets to include.
- Click Generate to add the data generation task to the queue.
A new repository will be created and populated with data based on the mask and generation settings.
Masking Data
You can generate a masked copy of a data set to hide sensitive information stored in your server. A masked data set contains the same number of data entries as the source, but any members/keys with the Mask and Generate Settings configured will be randomized according to the settings. You can also configure the data constraints settings to ensure that the masked data is correctly generated for your test scenarios.
- Click on a record type and choose Infer Constraints from the member's or key's ellipsis menu (also see Inferring Data Constraints).
- Click on the constraints to make any necessary adjustments.
- Choose Mask and Generate Settings from the member's or key's ellipsis menu.
- Choose a mode from the drop-down menu. The mode determines how the data is generated. Each mode has different options. See Mask and Generation Mode Settings for details.
- Configure the settings for the type you selected and click Save.
Click Mask Data in the toolbar.
All data members with mask and generate settings will be replaced in a new masked repository.
Inferring Data Constraints
The Data Modeling feature can automatically set constraints for generating new data based on the data in the repository. You infer constraints for the selected repository by choosing a repository in the sidebar and click the Infer Constraints button.
You can also infer constraints for individual members and keys by choosing Infer Constraints from the key/member ellipsis menu.
CTP will infer that the data is a Boolean, date, number, or string.
Editing Data Constraints
If you want to edit the constraints, click on the constraint properties and make changes in the Data Constraint Settings editor.
You can configure the following settings:
Type
Choose the Boolean type if the key/member should be constrained to true or false.
Choose the Date type if the key/member should be constrained to a date. You can configure the following settings:
Start | Specify a start and/or time. |
---|---|
End | Specify an ending date and/or time. |
Format | Specify the pattern that the start and end dates should follow. |
Choose the Number type if the key/member should be constrained to a number. You can configure the following settings:
Minimum | Enter the lowest number that can be generated. |
---|---|
Maximum | Enter the largest number that can be generated. |
Decimals | Enter the number of decimals allowed. |
Choose the String type if the key/member should be constrained to a string. You can configure the following settings:
Pattern | Define a pattern for the string using For example, you could randomly generate social security numbers using the following pattern:
|
---|---|
Character map | Specify the range of characters that can be used in the pattern. The default value when set to fixed is all printable ASCII characters, 0x20 (space) through 0x7e (~). |
Reference
You can configure the key/member to reference a specific data set/record type and key/member in the repository. Data sets are flagged with a :ds.
Testing Data Integrity
Data constraints can be configured manually by setting properties, using the Infer Constraints functionality, or through the definition file when creating a virtual asset from traffic in Virtualize. The integrity test functionality enables you to verify that the constraints are valid for the data stored in the repository.
You can test the integrity of individual members or all members in a data set by choosing Integrity Test from the ellipsis menu.
You can test the data integrity for the repository by clicking the Integrity Test button in the toolbar.
If no constraints are set, a warning will appear. If the data does not match the constraints, an error will appear and the member will be flagged.
You can click on the error message to see details in an overlay.
You can view additional information about the integrity tests in the Test Data Assistant Tasks tab.
Mask and Generation Mode Settings
Modes apply to primitive and list of primitive members. You can specify the mask and generation mode when adding members or change them for existing members.
None
Choose this mode if you do not want to configure mask and generation settings.
Formula
Choose this mode to specify a formula using foreign key constraints between record type members. Simple math, string, and date operations are supported. You can use aggregate functions in your formulas (e.g., SUM, COUNT, etc.).
See Consuming the Data in Tools for information on the syntax for referencing other record type members.
About Formula Variables
- Variables start with "
${
" (dollar sign and open curly brace) and end with "}
" (closed curly brace). - You can point to a member within the same record type using the
${member}
syntax. - If the variable references the same member for which the mask/generate settings are being applied, the original value will be used in the formula.
- You can point to a member within a specified record type using the
${recordType.member}
syntax. - You can point to a key within a specified data set using the
${dataSet:ds.key}
syntax.
Example Formula
SUM(${cart_item.price})*${sales_tax.rate})
From Seed
Choose this mode to generate data using values from an existing repository. This mode requires additional settings to be configured.
Type | Specify how the seed data should be copied to the generated repository. Random: Copies values to the generated repository randomly. Round Robin: Loops through the seed data as necessary to add records according to the generation settings. For example, if set the number of records to generate to 100, but the seed data only has 80 records, the gap will be filled by beginning copying data from the first 20 records. Unique: Each record will only be copied once. The number of records requested must be less than or equal to the number of records in the seed data during data generation. You will receive an error message if more records are requested than the number of records in the seed data. |
---|---|
Repository | Choose the seed repository. |
Data set | Choose the seed data set within the repository. |
Column | Choose a key column within the data set. |
Independent | Enable the Independent option generate member data independently from other member data that may be configured. When you generate data, you make a copy of existing repository and the selected data sets based on how the members are configured. Enabling the member data to be generated independently reduces potential conflicts. |
Random
Choose this mode to generate random Booleans, dates, numbers, or strings. Dates, numbers, and strings require additional configuration.
Dates
You can configure the following settings for generating and masking random dates:
Start | Specify a start and/or time. |
---|---|
End | Specify an ending date and/or time. |
Format | Specify the pattern that the start and end dates should follow. |
Numbers
You can configure the following settings for generating and masking random numbers:
Minimum | Enter the lowest number that can be generated. |
---|---|
Maximum | Enter the largest number that can be generated. |
Decimals | Enter the number of decimals allowed. |
Strings
You can configure the following settings for generating and masking random strings:
Pattern | Define a pattern for the string using For example, you could randomly generate social security numbers using the following pattern:
|
---|---|
Character map | Specify the range of characters that can be used in the pattern. The default value when set to fixed is all printable ASCII characters, 0x20 (space) through 0x7e (~). |
Ranged
Choose this mode to generate sequential numbers and dates starting with a specified value and incrementing to a specified end value. The configurations for ranged data are the same for random data, but ranged data also has an increment field for specifying how the data should increment.