TestExecute Exit Codes

Applies to TestExecute 15.40, last modified on March 25, 2022

This section describes exit codes that TestExecute returns. These codes report the result of the last test:

Exit Code Description
0 The last test did not produce errors or warnings.
1 The last test results include warnings but no errors.
2 The last test results include errors.
3 The test cannot be run because of an error. Some typical errors are:
  • TestComplete or TestExecute is already running (only one instance of TestComplete or TestExecute can be run at once on a single computer).

  • The specified project (or project suite) cannot be opened because the current user does not have appropriate permissions for this.

  • Test items are not selected to be run.

  • A test item refers to an unavailable element to be run (for example, a script routine that does not exist, or a project item that is unavailable because the needed plugins are disabled or not installed).

  • A test item is disabled or does not exist (for example, it could be deleted or renamed).

  • A project item file does not exist (for example, it could have been deleted, renamed, or moved to another folder).

  • The script contains a syntax error.

  • The file that the /ShareResults argument specifies already exists or its path is not valid.

  • The number of days that the /SharedResultsExpireIn argument specifies is not valid. The only possible values are 1, 7, and 14.

The test engine also returns the code 3, if you run a project or project suite and the test was stopped with a call to the Runner.Stop method within the OnStartTest event handler. In this case, TestExecute considers the test was unable to start.

4 The test run was stopped by the timeout specified with the /Timeout command-line argument.
127 Unable to launch TestExecute, because some TestExecute files are missing or the installation is damaged.
1000 Unable to launch TestExecute, because another instance of TestExecute is already running.
1001 Unable to start TestExecute, because there is not enough free disk space.
-1 Unable to launch TestExecute because the license check has failed and TestExecute cannot obtain a license.

You can find information on TestExecute licensing in TestExecute 15 Licensing Guide that is shipped with TestExecute.

Tip: Inspect the Error.log or Silent.log files to get more information on the possible reasons of the license check failure. For more information on these files, see the description of the /SilentMode and /ErrorLog command-line arguments in the TestExecute Command Line topic.

To resolve licensing problems, please use the Licensing Troubleshooter on our web site:

Licensing Troubleshooter

Other codes You may receive codes different from those above (for example, -10, -12). This can happen if your operating system, firewall, or a third-party application that manages TestExecute test runs overwrites the actual TestExecute exit code.

In this case, to learn the received exit code definition, contact your system administrator or the SmartBear Support team.

The exit codes that TestExecute returns depend on whether the project is configured to rerun failed tests. See the Control Test Execution Flow section in the TestComplete documentation.

Normally, these codes are of use when TestExecute is launched from a batch file. Here is a simple example:

Note: The following example uses the 32-bit version of TestExecute. If you use the 64-bit version, the TestExecute executable is located in the <TestExecute>\x64\Bin folder.

Batch File

REM Clears the screen
CLS
@ECHO OFF

REM Launches TestExecute
REM executes the specified project
REM and closes TestExecute when the run is over
C:\TestExecuteFolder\Bin\TestExecute.exe C:\Projects\MyProj\MyProj.mds /run /exit

IF ERRORLEVEL 1001 GOTO NotEnoughDiskSpace
IF ERRORLEVEL 1000 GOTO AnotherInstance
IF ERRORLEVEL 127 GOTO DamagedInstall
IF ERRORLEVEL 4 GOTO Timeout
IF ERRORLEVEL 3 GOTO CannotRun
IF ERRORLEVEL 2 GOTO Errors
IF ERRORLEVEL 1 GOTO Warnings
IF ERRORLEVEL 0 GOTO Success
IF ERRORLEVEL -1 GOTO LicenseFailed
 
:NotEnoughDiskSpace
ECHO There is not enough free disk space to run TestExecute
GOTO End
 
:AnotherInstance
ECHO Another instance of TestExecute is already running
GOTO End
 
:DamagedInstall
ECHO TestExecute installation is damaged or some files are missing
GOTO End
 
:Timeout
ECHO Timeout elapsed
GOTO End
 
:CannotRun
ECHO The script cannot be run
GOTO End
 
:Errors
ECHO There are errors
GOTO End
 
:Warnings
ECHO There are warnings
GOTO End
 
:Success
ECHO No errors
GOTO End
 
:LicenseFailed
ECHO License check failed
GOTO End

:End
When launching TestExecute from a command line or batch file, it is not recommended to use the RunAs command, since this will significantly slow down the script execution.

See Also

TestExecute Command Line

Highlight search results