Preparing an existing project for tests

Create a new →project and the POUs under test. However, it is also possible to use an already existing project in order to test the included POU – as long as the POUs under test are compliant to the restrictions as specified below.
images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg If you notice the warning The path <WorkspacePath>/.metadata/.plugins/com.logicals.lc3.testframework.core/lc3TestKeywords/library is absolute. RED prefers using workspace-relative paths which makes your projects more portable with the Problems view, ignore this warning.
Additional information:

  • When opening, importing and creating a project, the warning is automatically output by the tool "RED - Robot Editor". However, this warning does not impact the usage of the testframework.

  • It is possible that the system integrator has deactivated the test framework in your logi.CAD 3 variant (by using the configuration variable -Dlc3.enable.testframework). In this case, the above-mentioned warning is not displayed and the command to create and execute the test suites are not provied. In order to convert the project into a test project, select the command Activate Testframework in the context menu of the project.

Within the test project, execute the following steps:

  1. Make sure that the POU under test is found within the current project (= the test project).
    Example: Open an ST-editor and use the content assist in order to insert the call of the function block under test.

    It is possible to test the following →POUs:

    1. user-defined POUs that are located in the current project (e.g. within a →folder of the project) and their name does not start with the character _

    2. POUs located within →libraries and their name does not start with the character _
      The POUs might be user-defined POUs or system blocks.

    3. POUs not using one of the following blocks within the POU under test because they are not supported when a test is executed:


      If you do use one of these blocks within the POU under test anyway, it is not guaranteed that the test is correctly executed. images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg The respective block article contains information about why the block is not supported when a test is executed.

    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/error.svg Restriction: It is not possible to test a →method or an →interface . Moreover, logi.cals advises against creating tests for the elements of object-oriented programming (even if this would be possible). Reason: It cannot be guaranteed that the tests for these elements will be correctly created and processed. In logi.CAD 3, it is possible to declare the following elements of the object-oriented programming:

    • →interfaces

    • →methods

    • →function blocks that are derived from a base function block (by using the keyword EXTENDS)

    • function blocks that are implementing i nterfaces (by using the keyword IMPLEMENTS) and/or that are containing methods

  2. Recommended: Define a default for the simulated cycle time within the properties of the project: context menu of the project, command Properties and Test framework – Specify the default in ms.
    Result: This default is automatically used for the test cases. However, it is possible to change the simulated cycle time per test case later on (see under "Structure of the Excel test suite, modifying the worksheets").
    The default of logi.CAD 3 for the simulated cycle time is 10 ms.