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
-
The TestCase to be instantiated must be marked as a template (see chapter "Working with TestCase templates").
-
The TestCase template must be linked with a data source (see chapter "TestCase-Design Sheet or Class").
-
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").
-
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
-
The TestCase to be instantiated must be marked as a template (see chapter "Working with TestCase templates").
-
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").
-
Select the option Create TemplateInstance from the context menu of the TestCase template.
-
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.
-
Confirm your inputs with a click on the OK button.
-
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 |
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
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
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.