Getting and Setting Run Mode From Tests

Applies to TestComplete 14.91, last modified on July 20, 2021
Information in this topic applies to generic desktop applications (.NET, WPF, Delphi and others).

TestComplete lets you run desktop applications in several modes - Simple, Run As, Profile and Debug. You can change the run mode not only in the TestedApps editor, but also during the test run.

Scripting Objects

To access the run mode parameters from tests, you can use one of the following objects:

Run Mode Parameters Object
Simple TestedApps.AppName.Params.SimpleParams
RunAs TestedApps.AppName.Params.RunAsParams
Debug TestedApps.AppName.Params.DebugParams
Profile TestedApps.AppName.Params.ProfileParams

In addition, the TestedApps.AppName.Params.ActiveParams object provides access to the current run mode’s parameters.

Getting and Setting Run Mode From Scripts

To get an application’s current run mode, you can use the TestedApps.AppName.Params.ActiveParams.Name property. It returns the mode name as a string.

JavaScript, JScript

var app = TestedApps.MyApp;
Log.Message("The active run mode is " + app.Params.ActiveParams.Name);


app = TestedApps.MyApp
Log.Message("The active run mode is " + app.Params.ActiveParams.Name)


Dim app
Set app = TestedApps.MyApp
Call Log.Message("The active run mode is " & app.Params.ActiveParams.Name)


var app;
  app := TestedApps.MyApp;
  Log.Message('The active run mode is ' + app.Params.ActiveParams.Name);

C++Script, C#Script

var app = TestedApps["MyApp"];
Log["Message"]("The active run mode is " + app["Params"]["ActiveParams"]["Name"]);

Alternatively, you can use the TestedApps.AppName.Params.ModeNameParams.IsActive method to check if a specific mode is active (see the example below).

To set a run mode for your application, use the TestedApps.AppName.Params.ModeNameParams.Activate method:

JavaScript, JScript

if (! TestedApps.MyApp.Params.RunAsParams.IsActive())


if (not TestedApps.MyApp.Params.RunAsParams.IsActive()):


If Not TestedApps.MyApp.Params.RunAsParams.IsActive Then
End If


if not TestedApps.MyApp.Params.RunAsParams.IsActive then

C++Script, C#Script

if (! TestedApps["MyApp"]["Params"]["RunAsParams"]["IsActive"]())

Getting and Setting Run Mode From Keyword Tests

In keyword tests, you can call the above-mentioned object methods and properties using the Call Object Method, Run Code Snippet or Run Script Routine operation.


TestComplete includes a sample test project that tests an application in different run modes in a loop:

<TestComplete Samples>\Desktop\Running Tested Applications\Run Modes

Note: If you do not have the sample, download the TestComplete Samples installation package from the page of our website and run it.

See Also

Run Modes and Parameters
Run Modes and Parameters
Editing Desktop Application Parameters

Highlight search results