In this section:

Introduction

The ability to generate safe, realistic data can remove barriers to maintaining or increasing your testing velocity. As your data repositories become heavy with robust test data, it may be prudent to target specific types of data to be used in specific stages of the testing lifecycle.

In this section, we will cover how to subset data in the Test Data module. The subset functionality creates a copy of the repository using only the values specified in the data constraint settings.

Prerequisites

You should have completed the previous chapters in this tutorial:

You can alternatively follow this tutorial using an existing data repository. 

Configuring Data Constraints

The constraint describes the boundaries of the data. We can configure the constraints to define the subset of balances that only have negative values, for example.

  1. Click on the ParabankDB_masked_generated repository.
  2. Click on the Models tab and search for the BALANCE member associated with the customer_id result set. 

    Changing Display Names

    Searching may be easier if you change the display name to something more meaningful. See Exploring the Model for additional information.

  3. Click on the ellipses menu and choose Infer Constraints so that Test Data can process the data. New constraints will be set.
  4. These constraints, however, will not provide the data we want to test. Click the ellipses menu and choose Data Constraint Settings.
  5. Change the Minimum value to -1000 and the Maximum value to 0. This configures the constraints to only allow negative values.
  6. Click Save to close the Data Constraints Settings.
  7. Click the ellipses menu and choose Integrity Test. This test checks the values in the column against the constraints.
  8. Test Data will open an alert dialog showing that the member contains values outside of the constraints.
  9. Click on the link to view the details.

Testing the integrity of the data against the constraints is a helpful diagnostic step when fine-tuning your repository. No action is required in this instance because we are aware that there are values outside of the constraint. Click the x button to close the message.

Sub-setting and Reviewing the Data

After configuring and verifying the data constraint settings, we can generate the subset repository and review the data.

  1. Click the Subset Data button in the tool bar. 
  2. By default, the subset data repository will use the name of the source repository (ParabankDB_masked_generated) and append it with “_subset”. Click Subset to continue.
     
  3. When the task finishes, click on the ParabankDB_masked_generated_subset repository.
  4. Search for the BALANCE member column and click on the referenced SQL template. 
     
  5. Click the link to view the data.
     
  6. Expand the table to view the subset of records.
     

You can also switch to the ParabankDB_masked_generated_subset repository in your virtual asset configurations and view the records in ParaBank.

  1. Choose to the Service Virtualization module from the CTP applications menu and locate the parabank-login virtual asset. 
  2. Specify the ParabankDB_masked_generated_subset repository in the Repository name field and the parabank-login data set in the Data set name field. 
  3.  Save your changes and return to ParaBank.
  4. Refresh the page to view the records served from the data repository.

You now have a repository that can be used for testing negative values. You can subset the data any number of ways using the data constraints and the Subset Data functionality.  

Importing a Data Repository

We recommend creating an export of your repository before modifying the data so that you have initialized repository to import if necessary. You can either import to an existing repository, which overwrites the data, or create an empty repository for importing data.

  1. If you want to import to an existing repository skip to step  Click on your data repository server under the Data tab and click Create.
  2. Specify a name when prompted and click Confirm.
  3. Click on the exported repository ("ParabankDB-golden") to open the management options.
  4. Click Import. You can specify a name and a description. The name field is used to identify the task. By default, "Import" is prepended to the repository you are importing.
  5. Choose the destination repository and click OK.
  6. Click on the imported repository to verify the data.

You can use the export functionality to create snapshots of the repository so that you can manipulate the data and safely return to an initial state. 

  • No labels