Skip to main content

Command-Line Commands

In order to execute test scripts from the command line, the command-line command <directory>CODESYS.exe is provided with the parameters below. Parameters that are used with arguments have delimited the added argument with "=" or ":".

Example:

C:\Program Files (x86)\3S CODESYS\CODESYS\Common\CODESYS.exe --profile="CODESYS V3.5 SP13" --executecommand="TestManager ExecuteScript" --arg1:"--repository-name=ABC" --arg2:"--script=SaveBootProject" --arg3:"--version=1.0" --arg4:"--tester=autobuild" –arg5:"--store"

Tip

Include arguments which contain spaces, minus signs, or slashes enclosed by straight quotation marks: "<argument>".

Tip

You can also click Copy command line to clipboard to generate the command.

Parameter: --executecommand="TestManager ExecuteScript"

The parameter starts the execution of a test script, without opening CODESYS. To do this, the parameter needs at least one argument (--arg<X>:"<parameter>") which then passes one of the following parameters. For example, to pass the file path of the started test script.

--arg<X>:"<parameter>"

Command-line argument to pass one of the following parameters

The argument is always enclosed by straight quotation marks. <X> is an integer, it is incremented, and it indexes the argument. You can pass any number of arguments, each delimited by a space.

Parameter

--repository-location=<Argument>

Absolute location of the test repository

Example: --repository-location="D:\Test Manager\TestRepository_1"

--repository-name=<argument>

Name of the test repository in the Test Manager as you have created the test repository in the Edit Repository Locations dialog

Example: --repository-name=ABC

Note: Alternatives to the parameter --repository-location

--script=<argument>

Path (folder and name) of the script within the test repository

The hierarchical folders are separated by a period.

Example: --script=FOLDER_ABC.FOLDER_A.Test_Feature_A

--version=<argument>

Version of the test script

Optional

If you do not specify a version, then the newest version of the test script is used automatically.

Example: --version=1.2.3.4

--tester=<argument>

Name of the tester

Example: --tester=a.tester

--save-xml=<argument>

Target path of the report in XML format

Optional

Example: --save-xml=C:\TestData\Reports\MyReport1.xml

Hint: We recommend that you specify at least one of the –save-xml=, --save-html=, or --store parameters to avoid losing a report.

--save-html=<argument>

Target path of the report in HTML format

Optional

Example: --save-html=C:\TestData\Reports\MyReport1.html

Hint: We recommend that you specify at least one of the –save-xml=, --save-html=, or --store parameters to avoid losing a report.

--store

Saves the test report internally in the test repository

Optional

Hint: We recommend that you specify at least one of the –save-xml=, --save-html=, or --store parameters to avoid losing a report.

--report-name=<argument>

Name of the report in order not to save the report as the default name

Optional

Example: --report-name=Report_Feature_A

--overwrite-files

Overwrites existing files

Optional as additional parameter for --save-xml or --save-html

--progress=<argument>

Displays the progress of the test run as a data stream

The parameter needs at least one argument. A semicolon (;) is used to connect multiple arguments in a row.

. Arguments
  • <Absolute_Path>

    Sends the data in the text file path as a text file encoded as UTF-8 and BOM

    Example: --progress=C:\TestData\ABC\Progress.txt

  • none

    Sends the data as an empty list (no output)

  • stdout

    Sends the data to the default output (usually the monitor)

  • stderr

    Sends the data to the default error output

  • window

    Sends the data to the Test Manager user interface in the "Test Controller" view, as it is in the normal execution of a test script in CODESYS

Example: --progress=D:\tm.log.txt;stdout;window

--no-var-recording

The test report is reduced. The values of variables are not included in the test report when the following test elements are run: assignment, test script call, test action, choose (conditions).

Example 3. Example

--arg1:"--repository-location=D:\Testrepository_1" –-arg2:"—script=foo/bar" –-arg3:"—version=1.2.3.0" --arg4:"--progress=stdout;window"



Option: --exitafterexecutecommand

The option automatically closes CODESYS after executing a test script.

When the option is set, an exit code is returned.

Example 4. Example

C:\Program Files (x86)\3S CODESYS\CODESYS\Common\CoDeSys.exe --profile="CODESYS V3.5 SP3" --exitafterexecutecommand --executecommand="TestManager ExecuteScript" --arg1:"--repository-name=Repository_1" --arg2:"--script=SaveBootProject" --arg3:"--version=1.0" --arg4:"--tester=autobuild" –arg5:"--store"



Exit code

Description

0

No error has occurred.

1

There is no path specified for saving the HTML test report.

2

The specified directory for the HTML report does not exist and cannot be created.

3

There is no path specified for saving the XML test report.

4

The specified directory for the XML report does not exist and cannot be created.

5

The report name is blank or an invalid report name has been entered.

6

The report name is invalid because the last character is a period.

7

The entered command line option is invalid.

8

The --tester= argument was not specified.

9

The --script= argument was not specified.

10

The --repository-name= and --repository-location= arguments were not specified.

11

The entered repository name entered is unknown.

12

The repository is located in a different place than explicitly specified.

13

The repository cannot be opened.

14

The XML test report cannot be exported.

15

The HTML test report cannot be exported.

16

An error occurred while monitoring the test.

17

There is no test result from the execution.

18

The execution of the Reindex command has failed.

For more information, see: Reindex

19

No valid license has been found for the CODESYS Test Manager. No test report has been generated.