Skip to main content

Creating a Test Project

A test project which is suitable for a system test contains a compilable application with the system settings of the test system. The test system should be as similar as possible to the later production environment.

For an application test, there is usually already a project with the application which you want to test. For the example, you create a simple test project: Testprojekt SystemTest_A.project. The First_Script test script reads and checks the variables of this project. See: Creating a test script for a system test.

  1. Click the File → New Project command.

  2. Select the Standard Project template and specify the name SystemTest_A.project and the location D:\Projects.

    The Standard Project dialog will open.

  3. Select the device, and in PLC_PRG in, select the Structured Text (ST) language.

  4. Select the device in the Devices view. Then click the Simulation command in the context menu.

  5. In the Devices view, double-click PLC_PRG.

  6. Declare the variables which the test script checks:

    PROGRAM PLC_PRG
    VAR
        iValue1 : INT := 100;    
        iValue2 : INT := 200;    
        xDone : BOOL;
    END_VAR
  7. Implement the following code:

    IF NOT xDone THEN
        iValue1 := iValue1 + 1;
        iValue2 := iValue2 + 1;
        xDone := TRUE;
    END_IF

    When the application starts, the code increments both variables once: iValue1 to 101 and iValue2 to 201. After a reset, the variables have their initial values again.

  8. Save the project.