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 use the duplicate functionality to make a copy of a simple or hierarchical data set record type. Members/keys and their properties (constraints, mask, and generation settings) are also duplicated.

  1. Choose Duplicate Record Type from the record type ellipsis menu.
  2. 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 simple and hierarchical data sets.

  1. Choose a record type and click the Add Member button (+).



  2. 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).



  3. Choose a data generation mode for the new member. See Mask and Generation Settings for details.



  4. 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 the components in your data model. The following components can take properties:

  • members
  • keys
  • parameters (SQL)
  • columns (SQL)
  • result sets (SQL)

Generation and mask settings and data constraints are types of properties that are added when you infer constraints or generate data.   

  1. Click on a component and choose Add New Property from the ellipsis menu.  



  2. Define the property in the field that opens.
     


  3. Changes are automatically saved when you click away. 

To remove a property:

  1. Open the Remove Property menu.



  2. Click the trash icon.

     

Adding and Deleting SQL Templates

SQL templates are one or more SQL statements that represent the recorded SQL queries.

  1. Click on the data set mode in the model and click the Add Template button (+).
     
  2. Enter your SQL template and click Save.
     

The new template will appear in the model. It will be assigned a display name in a SQL# format and include an empty results set. 

To change the template display name:

  1. Click the ellipsis menu icon and choose Edit Display Name.
  2. Specify a new name when prompted and click Save. Changing the display name only affects how it's represented in the model and does not affect the underlying data.
     

To delete a template, click the ellipsis menu icon and choose Delete SQL Template.

Adding and Deleting SQL Parameters

SQL parameters are To add a parameter:

  1. Choose a template and click the Add Parameters button (+) for with the template parameters in the sidebar. 
  2. Specify a name for the parameter when prompted and click Create.

To delete a parameter:

  1. Click the ellipsis menu and choose Delete Parameter from the drop-down menu.
  2. Confirm that you want to delete the parameter when prompted. The parameter and all its associated data will be removed from the repository.

Adding and Deleting Columns

Columns in a SQL data set hold the data. 

  1. Click on a result set to view its columns.
  2. Click the Add Column button (+) in the Columns area and enter a name when prompted.
  3. Click Create.  

To delete a column:

  1. Click the column's ellipsis menu icon and choose Delete Column.
     
  2. Confirm that you want to delete the column when prompted.
     

Generating Data

You can generate data for SQL, hierarchical, and simple data sets. The data is generated according to the Mask and Generation Settings configured for the parameter, column, result set, member, or key member that holds the data. 

  1. Click on a record type or SQL template and choose Mask and Generate Settings from the component's ellipsis menu.  


    The Mask and Generate Settings for a result set are limited to the number of occurrences. 


  2. 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 Settings for details.
     


  3. Configure the Mask and Generation Settings for the type you selected and click Save.
  4. Click Generate Data in the toolbar.

     

  5. Specify a name for the generated repository, choose the number of records to generate, and select which original data sets to include. 



    For SQL templates, you will be able to expand SQL templates. 


     
  6. 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 entries as the source, but any data set components with the Mask and Generate Settings configured will be randomized according to the settings. You can mask data for the following types of components:

  • members
  • keys
  • parameters (SQL)
  • result sets (SQL)
  • columns (SQL)

You can also configure the data constraints settings to ensure that the masked data is correctly generated for your test scenarios.

  1. Click on a component and choose Infer Constraints from the member's or key's ellipsis menu (also see Inferring Data Constraints). You could manually set the constraints, but using the built-in function on existing data makes this step easier.
  2. Click on the constraints for any components if you need to make adjustments.
  3. Choose Mask and Generate Settings from the components ellipsis menu.
  4. 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 Settings for details.
  5. Configure the settings for the type you selected and click Save.
  6. Click Mask Data in the toolbar.

 

All data members with mask and generate settings will be replaced in a new masked repository.   

Subsetting Data

You can copy a subset of data from one repository into a new repository. 

  1. Open the repository from which you want to generate a subset. 
  2. Set the data constraints for the subset (see Inferring Data Constraints). Data that is within the specified constraints will be copied to the new subset repository. 
  3. (Optional) Click Integrity Test in the toolbar to verify that the constraints are valid (see Testing Data Integrity). Only data that passes the integrity test will be copied to the new subset repository. 
  4. Click Subset Data in the toolbar. 



  5. Specify a name for subset repository when prompted and click Subset

A copy of the repository is made that includes only the data within the constraints.

Subsetting SQL Data Sets

The following behaviors apply to subsetting SQL data sets:

  • If any of the column values in a result set row violates the data constraints, the entire row will not be copied. 
  • If the max occurrences constraint for the result set is configured, then the rows for that result set will stop being copied when the max is reached.
  • If any of the parameter values violates a data constraint, the SQL parameter row and associated result set will not be copied.
  • If the minimum occurrences constraint is configured for a result set, the SQL parameter rows for the set will not be copied if it does not have enough rows to meet the minimum constraint.

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:

StartSpecify a start and/or time.
EndSpecify an ending date and/or time.
FormatSpecify 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:

MinimumEnter the lowest number that can be generated.
MaximumEnter the largest number that can be generated.
DecimalsEnter 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 & as character variables, # as number variables, and \ to escape & and # variables.

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 (~).

The character map will be ignored if the pattern does not contain any ampersand (&) characters.

Reference

You can configure the component to reference the data in another component. This ensures that keys, members, columns, result sets, and other data-holding objects in the model remain consistent. Click in the Reference field and a hierarchical view of the objects in the data set appear.   

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 objects in the model (i.e, members, columns) or all objects 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 Settings

The Mask and Generation settings enable you to control the test data for various scenarios. Mask and Generation settings apply to the following types of data set components:

  • primitive members
  • list of primitive members
  • SQL parameters
  • SQL columns

The mode is not applicable to SQL result sets. The Mask and Generate Settings for SQL result sets enable you to configure the maximum and minimum number of times a SQL column appears in the result set.

The specific settings that are available depend on the mode. You can specify the mask and generation mode when adding members or change them for existing members. The following modes are available.

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.
  • In simple and hierarchical data sets, 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.

RepositoryChoose the seed repository.
Data setChoose the seed data set within the repository.
ColumnChoose 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:

StartSpecify a start and/or time.
EndSpecify an ending date and/or time.
FormatSpecify the pattern that the start and end dates should follow.

Numbers

You can configure the following settings for generating and masking random numbers:

MinimumEnter the lowest number that can be generated.
MaximumEnter the largest number that can be generated.
DecimalsEnter 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 & as character variables, # as number variables, and \ to escape & and # variables.

For example, you could randomly generate social security numbers using the following pattern:

###-##-####

Character mapSpecify 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.


  • No labels