Skip to main content

Dialog: Add Unit Test

Function: The dialog inserts a new test POU for the IEC unit test.

Call:

  • Project → Add Object menu

  • Context menu of the Application → Add Object

Table 89. Implementation

Setting

Description

Name of POU

Name of the test POU

The name is displayed in the test report. You can use the name later to control which test cases the Test Manager executes.

Type

. Template for the test POU
  • Extend TM.Testcase (recommended)

    Scheme for a single test case. The test POU extends TM.Testcase and consists of the methods Setup(), Execute(), Teardown(), and Abort(). See: Scheme for Single Test POUs, Implementing a single test POU

  • Extend TM.BaseMultiTest

    Scheme for multiple uniform test cases in one POU. The test POU extends TM.BaseMultiTest and consists of the following methods:

See: Scheme for Multitest POUs, Implementing a Multitest POU

Add optional methods

Adds the optional methods of the selected type, for example the methods Setup(), Teardown(), and Abort() for Extend TM.Testcase.

Add implementation template

Fills all generated methods with a sample implementation.

TODO comments show where to insert your own test logic. Recommended when you write a new test case.

Add explanatory comments

Inserts a comment in the declaration part of the test POU and in each method which explains how the POU pattern works. Recommended if you are not yet familiar with the pattern.



Table 90. Optional Attributes

Setting

Description

Test case name

Name of the test case. The Test Manager uses it instead of the name of the test POU.

For more information, see the following: Pragmas in Test POUs

Test case category

Comma-separated list of categories which the test case belongs to

You can use the categories later to control which test cases the Test Manager executes.

For more information, see the following: Pragmas in Test POUs

Test case timeout

Maximum execution time of the test case in ms. If the test case takes longer, then the Test Manager aborts it and calls the Abort() method, if applicable. With the value 0, the execution time is unlimited.

Test case group

Adds the testcasegroup attribute in the declaration part

Available only for the Extend TM.BaseMultiTest type.

Test case group timeout

Adds the testcasegrouptimeout attribute in the declaration part

Available only for the Extend TM.BaseMultiTest type.