Value Templates

A value template is a named set of test values that you can load into any test of the same source with one click. Instead of entering the same values again for every test, you enter them once, save them as a template ("A typical order", "A customer with no history"), and reuse them across rules, versions and team members. Templates belong to a source object and are shared by everyone who works with it.

Value templates use these parts of the Rule Repository:

  • The Templates... list at the top of the Fields View in the Test dialog. It starts with New template..., followed by the source's templates. When a template is loaded, an Update button appears beside the list.
  • The Template name... box and Add, at the bottom of the Fields View, which save the values on screen as a new template.
  • The Value Templates tab in the Source Object and Source Version dialogs. In a Source Object dialog it lists the templates of every version of the source; in a Source Version dialog, only the templates saved against that version. The tab's label shows how many there are.

What a Template Keeps

  • The input values you set, including collections and their items.
  • The values set on in-rule methods.
  • The expected field values, when the test type is Expectation.

A template does not keep the values of individual method calls, the expected result, or expectations about actions. Those belong to one rule's test.

Saving Values as a New Template

  1. In the Test dialog, set the values you want to keep.
  2. Type a name in the Template name... box at the bottom of the Fields View.
  3. Click Add. The template is saved against the source version you are testing with, and is now the one loaded.

Loading a Template

  1. In the Test dialog, open the Templates... list.
  2. Select the template. Its values replace the ones in the Fields View. If the template has expected values, they replace the expected values too; if it has none, the expected values are cleared.

You can load a template saved against a different version of the source. A value that no longer fits its field, for example a number outside its new limits, is marked in amber and still used. A value that no longer makes sense, such as text in what is now a number, is marked and left out of the run.

Updating a Template

  1. Load the template.
  2. Change the values.
  3. Click Update. The template now holds the values on screen and is moved to the source version you are testing with.

To stop working on the loaded template without changing it, select New template... in the list. Your values stay on screen.

Managing Templates

  1. Open the Source Object or Source Version dialog and click the Value Templates tab.
  2. Click a template. Its details slide in: the source version it was saved against, its name, its description, and its values as a table of Field, Input Values and, when it has them, Expected Values. Values the template keeps for fields this source version does not have are listed under Not in this source version.
  3. To rename a template or describe it, change the name in the box at the top, or type in the Description... box under it, and click Save. Saving changes only the name and description.
  4. To delete it, click Delete and confirm.
  5. Click the back arrow at the top left to return to the list.

Hover over a template in the list to see who created it and when.

Deleting a source version or a source object deletes its templates with it. A saved test is never affected: it keeps its own copy of its values.

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×