In this section:
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 TDA. The subset functionality creates a copy of the repository using only the values specified in the data constraint settings.
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.
- Open TDA and click on the ParabankDB_masked_generated repository.
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.
- Click on the ellipses menu and choose Infer Constraints so that TDA can process the data. New constraints will be set.
- These constraints, however, will not provide the data we want to test. Click the ellipses menu and choose Data Constraint Settings.
- Change the Minimum value to
-1000and the Maximum value to
0. This configures the constraints to only allow negative values.
- Click Save to close the Data Constraints Settings.
- Click the ellipses menu and choose Integrity Test. This test checks the values in the column against the constraints.
- TDA will open an alert dialog showing that the member contains values outside of the constraints.
- 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.
- Click the Subset Data button in the TDA tool bar.
- 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.
- When the task finishes, click on the ParabankDB_masked_generated_subset repository.
- Search for the BALANCE member column and click on the referenced SQL template.
- Click the link to view the data.
- 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.
- Choose to the Service Virtualization module from the CTP applications menu and locate the parabank-login virtual asset.
- Specify the ParabankDB_masked_generated_subset repository in the Repository name field and the parabank-login data set in the Data set name field.
- Save your changes and return to ParaBank.
- 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.
- 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.
- Specify a name when prompted and click Confirm.
- Click on the exported repository ("ParabankDB-golden") to open the management options.
- 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.
- Choose the destination repository and click OK.
- 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.