Create your own TestCase templates

TestCase templates form the basis of your Data Intergity tests. When you run a DI Wizard, the Wizard uses a template to create your TestCase.

If you do not want to use one of the TestCase templates provided in the Tosca Data Integrity Modules And Samples.tsu subset, you can create your own.

To do so, follow the steps below:

  1. Create a new TestCases folder in the _DI Templates folder.

  2. In this folder, create a new TestCase.

Create a new TestCase

  1. To create TestSteps, drag and drop an appropriate Module onto the TestCase.

    For example, to create a TestCase template for Field Tests: Database to Database, you can use the DI DB Expert Module from the Tosca Data Integrity Modules And Samples.tsu subset.

    Drag and drop it onto the TestCase twice: Once for the source and once for the target.

Drag and drop the Module onto the TestCase to create a TestStep

  1. Rename the newly created TestSteps.

  2. Connect to the source and target of your data: Specify one of the connections you have defined in the Connection Manager for each TestStep.

    To do so, click into the Value field and select a connection from the drop-down menu. Note that you can't override the specified connection with dynamic expressions such as buffers or test configuration parameters.

Example TestCase with Sample connection 1 as source and target

  1. In each TestStep, enter an appropriate value for SQL Statement. Check the sample TestSheets in the _DI Sample Tests and Execution Lists folder for information on available attributes for XL paths.

    For example, refer to the sample TestSheet Field tests for comparing tables to see which attributes you can use for Field Tests: Database to Database tests.

Sample TestSheet: Attributes - TestStep: SQL Statement

  1. Fill out any additional TestStepValues that you need to run tests with this template.

    For example, in a Database To Database field test, you may want to get one or more values from the source database and compare it to the target database. Modify your TestSteps accordingly:

Example TestStepValues for Field tests

  1. Specify the required template properties for your TestCase.

Properties of a Field Tests: Database to Database TestStep

  1. Right-click the TestCase and select Convert to Template from the context menu.

  2. If you are creating a template for Pre-Screening: File or Vital Checks: Database to Database tests, add the condition 'Status' != 'Deleted' to your TestCase template.

    This condition ensures that if you later update your TestCases with the Update Wizard, the Update Wizard does not create TestCase instances for deleted TestSheet instances.

    To do so, add the column Condition via Column Chooser and type in the condition.

Example condition for a Vital Checks TestCase template

  1. You can now run the Wizard and create your TestCases. To do so, create a new Data Integrity folder and run the respective Wizard on this folder.

Create a DI folder

  1. In the Wizard, select the test you have created.

    In this example for a Database To Database field test, you can select the test created with the TestCase template in Step 4 - Select Field Tests.

Select your test in Step 4 - Select Field Tests

Set required TestCase template properties

Which properties to set in your TestCase template depends on the type of test you want to run with it.

To set a property for your TestCase template, follow the steps below:

  1. Expand the Properties pane by clicking the Properties icon in the top right corner of your workspace window.

  2. Fill out the properties as described in the chapters below.

Properties for Pre-Screening tests

If you create a template for Pre-Screening tests, set the following properties:

Property

Value

DITestDirection

FileOnly

DITemplate

True

DITemplateType

Prescreening

Properties for Field Tests: Single Database tests

If you create a template for Field Tests tests, set the following properties:

Property

Value

DITestDirection

SingleDatabase

DITemplate

True

DITemplateType

Field

Properties for Field Tests: Database to Database tests

If you create a template for Field Tests tests, set the following properties:

Property

Value

DITestDirection

DatabaseToDatabase

DITemplate

True

DITemplateType

Field

Properties for Vital Checks: File to Database tests

If you create a template for Vital Checks: File to Database tests, set the following properties:

Property

Value

DITestDirection

The value depends on what you want to test:

  • Templates for file field tests need the value FileOnly.

  • Templates for Completeness or Metadata tests need the value FileToDatabase.

DITemplate

True

DITemplateType

Set the Value according to the test you would like to run with this template:

  • Prescreening for your file tests

  • Completeness or Metadata for your database tests

Properties for Vital Checks: Database to Database tests

If you create a template for Vital Checks: File to Database tests, set the following properties:

Property

Value

DITestDirection

DatabaseToDatabase

DITemplate

True

DITemplateType

Set the Value according to the test you would like to run with this template:

  • Completeness

  • Metadata

  • Uniqueness

  • ReferentialIntegrity

  • Nullness