Element: IEC Unit Test
Symbol:
Function: The IEC Unit Test element is used for automatically searching the (preparatory) loaded test project for test POUs and test tables, and then creating a test application from them. Then this test application is loaded, started, and the tests are performed. Finally, the results are saved in a test report.
The requirement is that the test project contains test POUs or test tables.
Title | Title of the IEC unit test, which appears in the test report The title may contain spaces. Example: |
Device read timeout (ms) | Maximum waiting time (in ms) during communication with the controller If the time is exceeded, then error handling is started and an error is issued. For example, the timeout is monitored when variables are monitored. Example: Note: During the test run, the timeout is monitored continuously: usually when logging in, when the application status is read out. Then for each single test case execution (at least once), when status and results are read. |
Login retries | Number of login attempts If the number is exceeded, then error handling is started and an error is issued. |
List of libraries that contain test POUs These library POUs are instantiated, executed, and evaluated automatically in the test application during the test run. Double-click in the table in the top free row in the respective column to open an input field. | |
Name | Library which is integrated in the test project by at least one library administrator Their referencing type have to match the information in the Library Manager. Alternatively, a variable could also be specified for the library name.
|
Version |
|
Company |
|
Both input fields are used to restrict the selection of POUs to be included in the test run. You can specify Selected categories explicitly and/or Excluded categories of POUs explicitly. If no explicitly selected category is specified, then the test POUs of all categories are selected implicitly. The list of excluded categories is applied based on this selection. Excluded function blocks are not instantiated, executed, or evaluated during the test run. This allows you to customize the test case at script level, for example to use it for controllers with different hardware. Requirement: The test POUs or test tables contained in the test project have declared test categories. A test POU is categorized by the pragma Double-click on the left in the top free row to open an input field. You can specify the name of one or (comma-separated) multiple POU categories per line. Example: A dynamic configuration of the POU categories to be included or excluded is possible by means of placeholders. The placeholder consists of the name of a test variable enclosed in braces. This test variable is assigned one or more category names and/or POU names by means of an assignment in the test script. Example: In the test script, you assign a POU category Example of a combined input in the Selected categories field: |
Both input fields are used to restrict the selection of POUs to be included in the test run. Specify either Selected functions explicitly or Excluded functions explicitly. These lists are evaluated in addition to the Selected categories and Excluded categories lists described above. You can specify the POU name or the test case name, which has been defined with the compiler directive Example: All of the following input will result in the execution of the POU with the name Selected functions: TestCase_01 tc1 tc? TestCase_0* *_01 Declaration: {attribute 'test'} {attribute 'testcasename':='tc1'} {attribute 'testcasetimeout' := '60000'} FUNCTION_BLOCK TestCase_01 EXTENDS TM.Testcase VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR END_VAR super^(); Excluded function blocks are not instantiated, executed, or evaluated during the test run. In this way, you can control the execution of the test case at the script level. For example, you can control the execution of a test case for controllers with different hardware. For input and input syntax, see the section above: Selected categories and Excluded categories. ImportantIn the case of multitests, values of the Example: The test cases with the variable value Excluded functions: TestStep #0: Intial value Implementation: CASE diTestCaseIndex OF 0: // Test Case #0 - tests the same as CTD_InitialValue IF THIS^.xGetTestInfo THEN // Test case header THIS^.wsTestCaseName := "TestStep #0: Intial value"; THIS^.wsTestCaseCategories := "Multitest"; THIS^.diTestCaseTimeout := 200; xDone := TRUE; ELSE ... |
Single application mode |
On some devices, especially embedded devices, only one application is permitted. They are not able to process multiple applications. Similarly, only one application per device is permitted in the device tree of the test project. To generate a compilable test project, a backup device is created for these devices instead of a backup application (backup copy of the original application named Note: Select this option also for devices whose application name cannot be changed. Then the device in the project is renamed, not the applications. |