Creating TemplateInstances

TestCase TemplateInstances serve as containers for TestCases that are dynamically generated from a TestCase Template. TestCase TemplateInstances have to be linked to a data source, from which the data for generating the TestCases is read.

Each template may include several TestCase TemplateInstances which in turn can each be linked to any data source.

The property TestCaseWorkstate of the newly generated TestCases in the TemplateInstance are transferred from the TestCase template (see chapter "TestCaseWorkState").

How to instantiate TestCases with TestCase-Design

  1. The TestCase to be instantiated must be marked as a template (see chapter "Working with TestCase templates").

  2. The TestCase template must be linked with a data source (see chapter "Use a TestCase-Design Sheet or Class").

  3. Parameters, whose values should be transferred from the template, must be linked with attributes of the template via the specified syntax (see chapter "Specifying paths for test data").

  4. Select the option Create TemplateInstance from the context menu of the TestCase template:

Create TemplateInstance

As a result, Tosca creates a TestCase in the TemplateInstance for each TestCase defined in the template. The TestCase structure matches the structure of the corresponding TestCase in the template.

Instantiated TestCases

How to instantiate TestCases with Excel

  1. The TestCase to be instantiated must be marked as a template (see chapter "Working with TestCase templates").

  2. Parameters, whose values should be transferred from the template, must be linked with attributes of the template via the specified syntax (see chapter "Specifying paths for test data").

  3. Select the option Create TemplateInstance from the context menu of the TestCase template.

  4. The Excel file with the corresponding spreadsheet must be specified in the subsequent dialog. You can also define the data source via the property SchemaPath. In this case, the path is already shown in the dialog box.

Data source path

  1. Confirm your inputs with a click on the OK button.

  2. Click on Yes in the subsequent dialog, and the instantiation process will start.

Tosca creates a TestCase in the TemplateInstance for each TestCase defined in the template. The TestCase structure matches the structure of the corresponding TestCase in the template.

Creating TestCase Templates and Template Instances from a TestCase

TestCase Templates, Template Instances and the corresponding TestSheet can be easily created from a TestCase (see chapter "Create a TestSheet from a TestCase").

Define breakpoint for instantiation

Within a TestCase template you can specify a certain point where the instantiation should end. This can be done in the Details view of the respective TestStep by selecting the box in the Break column. The Break column must be added via the Column Chooser (see chapter "Add or remove columns").

Any existing TestSteps, which are available in the Template instance subsequent to this TestStep, are not instantiated.

If a breakpoint is used, negative tests can also be mapped without the need to use complex directory structures. The breakpoint (Break) is set and the condition AttrA == "Negative" is assigned to the folder Negative Test A. If the condition is true, the instantiation ends exactly at the breakpoint and only the TestSteps Prepare A and Negative Test A are generated. If the condition is false, the template instance contains the TestSteps Prepare A and TestStep A, whereas the TestStep Negative Test A will be ignored.

Column Break

Properties

ChangedManually

Shows whether the generated TestCases of the TestCaseTemplateInstance have been changed manually since their last generation.

ChangedManually will be reset as soon as the TestCases are generated again.

DataSourcePath

Describes the path to the data source which contains the template data. The manipulation is done either directly in the properties or with the DataSource-Wizard.

When using an Excel schema source, variables can be defined instead of absolute paths (see chapter "Options - Path variables").

InstantiationSelector

Selects sub-quantities from the total quantity of TestCases defined in the data source, in order to restrict the dynamic TestCase generation. These sub-quantities must be specified in the data source.

InstanceName

The value of this property manipulates the name of the reinstantiated TestCases (see chapter "InstanceName").

Options

Reinstantiate Instance

This option is available for TemplateInstances. The instantiation is thus repeated. This requires that the TemplateInstance is linked with a data source. The key combination Ctrl + R can also be used for reinstantiation.

Generating TestCases from a template

Edit schema path

This opens the DataSource Wizard.

In the DataSource Wizard you can specify the data source and the Instantiation Selector (the path to the Microsoft® Excel document and certain worksheets).

Run in ScratchBook

Runs one or more selected TestCase TemplateInstances in the ScratchBook.