Materialize Child Tests

Prev Next

Materializing a template test creates, updates or deletes its child tests so they match the template and its current list of tables or columns. Click Materialize Child Tests on the saved template, choose what to do with the child tests it already has, and click Materialize.

Nothing about a template runs until it is materialized. Saving a template changes the template, not its children.

When to materialize

  • The first time, to create the child tests.
  • After you change the template, so the children pick up the change.
  • After the object list changes: the catalog was ingested again and a filter now matches more or fewer tables, a metadata script returns different rows, or you uploaded a new import file.
  • Before every scheduled run, by letting the job step materialize (see the job section below).

Materialize from the template

  1. Open the template test and click Save if you have unsaved changes. Materialize Child Tests is unavailable until the template is saved.
  2. Click Materialize Child Tests.
  3. Read the Statistics panel. It shows Tests to be created and, once the template has children, Tests to be deleted, Customized tests and Non-customized tests. The first time, it shows only Tests to be created.
  4. If the template already has child tests, tick the options you want under For Previously Materialized Tests. The dialog starts from the template's saved choices; on a new template, none are ticked.
  5. Click Materialize.

The dialog also shows the Folder Location for Save from the template's Child Test Configuration tab. If a new child's name matches a test that already exists, the dialog says so and the child is renamed.

When it finishes, the Test Summary panel on the template shows Last materialized and Last materialized by, and the Child Tests tab lists every child.

The Materialize Child Tests dialog on a template that already has children: the Statistics panel and the four options under For Previously Materialized Tests, both highlighted

The options

Option What it does Leave it unticked when
Delete all child tests for objects no longer selected in metadata Deletes the child test of every table or column that has left the selection, for example a dropped table The selection might be temporarily wrong, such as during a failed ingestion
Delete empty child folders Removes child folders that are left empty You keep other tests in those folders
Update all non-customized child tests Rewrites every child nobody has edited by hand to match the current template You want the existing children to stay as they are for now
Overwrite all customized child tests Rewrites every child, including ones someone edited by hand. Their hand edits are lost Anyone has tuned individual children on purpose

New child tests for newly selected objects are always created, whichever options you tick.

How a child test is matched to its object

Every child test has a key, shown in the Key column of the Child Tests tab. When the template materializes again, a child whose key is still in the object list is kept (and updated if you ticked an update option). A key that is new gets a new child. A key that has gone counts toward Tests to be deleted.

Object list from Key
Metadata Driven, Table target schema.table, in lower case, such as sales.orders
Metadata Driven, Column target schema.table.column, in lower case
Metadata Script or Import File The test.key column if your script or file has one, otherwise built from schema.name, table.name and (for columns) column.name the same way

The key is also a variable: the default child name is {{var.template_test_name}} - {{test.key}}.

Two consequences:

  • Renaming a table creates a new child. To Validatar, Sales.Orders renamed to Sales.CustomerOrders is a new key, so the next materialize creates a child for the new name, and the old child counts as no longer selected.
  • Changing how keys are built replaces every child. If you add or change a test.key column, every child gets a new key. Materialize, then check the Child Tests tab: if it shows no children, materialize once more.

Customized and non-customized child tests

A child test becomes customized when someone opens it and saves a change to its definition, such as its name, description, queries or result configuration. The Custom column of the Child Tests tab marks customized children, and you can filter on it to see Customized or Non-customized ones.

The split exists so a hand-tuned child survives a template change. Tick Update all non-customized child tests to roll a template change out to everything else, and leave Overwrite all customized child tests unticked to keep the hand-tuned ones. Tick both to put every child back in line with the template.

What deleting a child test does

When materialization or Delete Child Tests deletes a child test:

  • The child test leaves the project's folders.
  • Its execution history is kept: deleting tests does not delete test execution history.
  • A job step that ran that child test directly is disabled.
  • If its object comes back later, the next materialize creates a new child test for it, with its own history.

A child you delete by hand while its object is still selected comes back too: the next materialize creates it again.

Warning: an empty object list deletes every child test. If a filter suddenly matches nothing, a metadata script returns no rows, or an import file is empty, a materialize with Delete all child tests for objects no longer selected in metadata ticked deletes all the template's children, with no error. Before you click Materialize, compare Tests to be deleted with Current tests in the template's Test Summary panel: if they are equal, stop and find out why. In a job, the same thing happens without anyone looking, so make sure ingestion and the scripts that feed a template cannot quietly return nothing.

Materialize in a job

A job can materialize a template right before it runs the children, so tonight's run covers tonight's catalog.

  • Template test step: in the step's settings, tick Materialize child tests before execution and choose the same four options, then tick Execute child tests and set how many tests run in parallel.
  • Folder step: under Template Tests, tick Materialize child tests to materialize every template in the folder before its tests run.

See Create a Job for adding steps, and Schedule a Job to run it every night.

The Configure Step dialog for a template step, with Materialize child tests before execution ticked and highlighted, its four options, and Execute child tests

Delete Child Tests

Delete Child Tests, on the template's toolbar, deletes the children without materializing. The dialog says how many there are. Choose the button that deletes them all, which shows the count (for example Delete All 49 Tests), or Delete Only Non-Customized Tests to keep the hand-edited ones. The template itself stays; materialize it again to recreate the children.

To delete only the children of objects that left the selection, materialize with Delete all child tests for objects no longer selected in metadata instead.

Validatar AI

The Validatar AI chat (Validatar Cloud, beta) cannot materialize a template test. It can create a template, but you materialize it here, from the template's page, or with a job step.

Troubleshooting

Symptom Cause Fix
Materialize Child Tests is greyed out The template has unsaved changes, you are viewing an older version, or you cannot edit this template Save; switch to the latest version; ask for the Create Tests permission
Tests to be created is 0 the first time The object list is empty Check the selection: Preview Objects on the Metadata Selection tab, or the script or file
A template change did not reach the children Update all non-customized child tests was not ticked, or the children are customized Materialize again with the right option; check the Custom column
Children disappeared after a job ran The object list was empty during that run and the step deletes children for objects no longer selected Fix the source of the list, then materialize again; history of the deleted children is kept
A child test has a warning icon in Status Materialization reported a problem for that object Click the icon to read the message

Related