Skip to main content

Variable

Variables can be used in the test script for read or write access. In the Assignment element, for example, the variable to the left of the operator is used for write access and a variable to the right of the operator is used for read access.

Declaration and write access to a variable

When a variable is specified for a write access, the variable is declared automatically.

. Write access
  • Assignment element in Variable input field:

    Left side of the assignment

  • Test Action element in the Parameters tab of Output Parameters:

    Passes a variable as an output parameter

Read access to a variable

If settings are in the configuration of a test case of the Configuration tab:

{<variable_name>}

Within test actions (and only here), a variable name is specified with a placeholder operator.

Example: {BasePath}

Read and write access to global variables

$GLOBALS.<variable_name>

Example: $GLOBALS.HOME

Read access to $EXEC variables

$EXEC.<name>

With $EXEC variables, you are granted read permission to the meta information of the test script that is currently executed. All $EXEC variables have the data type STRING.

  • $EXEC.SCRIPT_NAME: Name of the test script which is currently executed, even if it has been started within the _tm_icon_call.pngCall test element by a superordinate test script

  • $EXEC.SCRIPT_FULLNAME: Full name of the test script which is currently executed, even if it has been started within the _tm_icon_call.pngCall test element by a superordinate test script

  • $EXEC.SCRIPT_VERSION: Version (as string) of the current test script, even if it has been started within the _tm_icon_call.pngCall test element by a superordinate test script

  • $EXEC.TESTCASE_TITLE: Title of the test case which is currently executed

    If a test case is not executed, then the variable is empty.

  • $EXEC.TESTACTION_TITLE: Title of the test action that is currently executed

    Otherwise the variable is empty.

  • $EXEC.STARTSCRIPT_FULLNAME: Full name of the test script which has started the test execution in this Test Manager instance

  • $EXEC.STARTSCRIPT_VERSION: Version (as string) of the test script which has started the test execution in this Test Manager instance

  • $EXEC.TESTER_NAME: Name of the tester who has started the test execution

Read access to system information with $ENV variables

$ENV.<environment_variable_name>

Environment_Variable_Name: Name of an environment variable which has been set in the system

With the $ENV variables, you are granted read permission to system area variables.

Example: $ENV.TEMP to access the TEMP path which is defined for your system

Read access to information about the test repository with the $REPO variable

$REPO.PARENTPATH

The variable automatically contains the absolute path of the directory which is above the directory of the test repository that is currently selected. The test projects for the test repository scripts are usually stored there.

You can also use the variable to refer to other paths relative to the test repository path.

Example: The variable contains C:\Users\<User>\AppData\Local\CODESYS Test Manager. This is the superordinate directory of the default test repository and is the location of the default test projects.

$REPO.NAME

The variable contains the name of the current test repository (example: Default Test Repository).

$REPO.LOCATION

The variable contains the file path of the current test repository (example: C:\Users\<User>\AppData\Local\CODESYS Test Manager\Test Repository).