Configuring a test table
First add a test table object. The Add test table dialog helps with the configuration. When you specify a testee in this dialog, its inputs and outputs are displayed. You can activate the ones in the list which are relevant for the test. When the dialog is closed, a test table is automatically created.
Then you configure test steps, assign the input values to each test step, and implement the tests.
Creating a project with a test table
In the device tree, select the Application object.
Click
.Select the Test Table object.
The Add Test Table dialog opens.
In the Name input field, specify the name.
Example:
Test_FB_A
In the Testee setting, click the
button.
The Input Assistant dialog opens.
Select the function block (or program to be tested) from the test project.
Example:
FB_A
Note:
Access to a library POU may be not be unique. Therefore, specify the POU name with namespace prefix.
A function cannot be tested. However, you can create a function block which calls this function and also maps the function inputs and outputs 1:1 (wrapper function block). Then test them.
Click OK to exit the dialog.
A testee is defined in the Insert test table dialog.
Click the Scan Testee button.
A list of all inputs and outputs of the testee is displayed in Select from available inputs and outputs.
Activate the inputs which lead to a change in state.
Specify conditions, if necessary.
Activate the outputs whose values are relevant for the test.
The enabled inputs, conditions, and outputs are displayed as columns on the Tabular Editor tab. This makes it easier for you to configure the input and output assignments. However, the conditional values for the inputs and the specified values for the outputs are still missing.
Click Add to confirm the dialog.
The
Test_FB_A
test table with theFB_A
testee has been created and inserted below the application.The Tabular Editor tab is displayed in the editor with the automatically configured columns. A column has been configured for each of the enabled inputs and outputs. Inputs have gotten the column type Assignment. Outputs have gotten the column type Testee. The values for the assignments and tests are missing. You can also see this from the fact that only the column headers are configured. The fields below the columns are still empty.
Assigning input values and implementing tests
Open the test table object.
In the editor, select the Tabular Editor.
Insert a test case.
Add a test step below that.
Specify all required status change variables and all variables to be tested for the test step.
Specify the input assignment.
Double-click the test table object.
In the editor, select the Tabular Editor tab.
Select the row
<click to create a test case> and specify a name that describes the test case. It may contain spaces.
Example:
Test Case 1: Best Case of FB_A
onThe test case is inserted with a test step below it.
Select the test step
<click to create a test step> and specify a name that describes the test step. Note that a test step name may contain spaces.
Example:
Step1: Set input combination ABC
The test step appears. The Duration and Call columns are configured automatically.
Duration: Single
Call: Enabled
In the row of the test step, double-click in the column of an input.
If the data type of the column is a basic data type, then a list box is displayed which contains possible assignments for the column.
Otherwise, an input field is displayed for specifying the assignment.
In the list box, select an assignment or edit the input field manually. Assignments are IEC code.
Input assignments are assignments whose coding begins with
:=
.Output assignments are tests whose coding begins with a comparison operator(example:
=
).Specify as many test steps as are necessary to reach all states of the testee.
Specify test cases according to your test strategy. Examples include testing for long-term, best case, minimal value, maximal value, or error case.
Arrange your test cases into test case groups (for example, by device or by test method).