IsActive Method

Applies to TestComplete 15.31, last modified on March 17, 2022

Description

A tested application can be run in various modes. To modify run-mode parameters, TestComplete offers special program objects. These objects are collections that contain parameters specific to run modes. One of these run modes is set as active for the tested application. The IsActive method specifies whether the ParamsObj parameter collection is active.

Declaration

ProgObj.IsActive()

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
Result Boolean

Applies To

The method is applied to the following objects:

Result Value

A boolean value that specifies which run mode, for the given parameter collection, is currently selected.

Example

The following code snippet checks whether the Debug run mode is currently selected for the application. If the Debug run mode is not selected, the code activates it and launches the tested application.

JavaScript, JScript

function Test()
{
  var TestApp, DebugParams;
  TestApp = TestedApps.Items("SampleApp");
  // Obtains the Debug run mode parameters
  DebugParams = TestApp.Params.DebugParams;
  // Checks if the Debug run mode is activated
  if (! DebugParams.IsActive())
    // Enables the Debug run mode
    DebugParams.Activate();

  // Launches the tested application
  TestApp.Run();
}

Python

def Test():
  TestApp = TestedApps.Items["SampleApp"]
  # Obtains the Debug run mode parameters 
  DebugParams = TestApp.Params.DebugParams
  # Checks if the Debug run mode is activated 
  if not DebugParams.IsActive():
    # Enables the Debug run mode
    DebugParams.Activate()
  # Launches the tested application 
  TestApp.Run()

VBScript

Sub Test
  Dim TestApp, DebugParams
  Set TestApp = TestedApps.Items("SampleApp")
  ' Obtains the Debug run mode parameters
  Set DebugParams = TestApp.Params.DebugParams
  ' Checks if the Debug run mode is activated
  If Not DebugParams.IsActive Then
    ' Enables the Debug run mode
    DebugParams.Activate
  End If

  ' Launches the tested application
  TestApp.Run
End Sub

DelphiScript

procedure Test;
var TestApp, DebugParams;
begin
  TestApp := TestedApps.Items('SampleApp');
  // Obtains the Debug run mode parameters
  DebugParams := TestApp.Params.DebugParams;
  // Checks if the Debug run mode is activated
  if not DebugParams.IsActive then
    // Enables the Debug run mode
    DebugParams.Activate;

  // Launches the tested application
  TestApp.Run();
end;

C++Script, C#Script

function Test()
{
  var TestApp, DebugParams;
  TestApp = TestedApps["Items"]("SampleApp");
  // Obtains the Debug run mode parameters
  DebugParams = TestApp["Params"]["DebugParams"];
  // Checks if the Debug run mode is activated
  if (! DebugParams["IsActive"]())
    // Enables the Debug run mode
    DebugParams["Activate"]();

  // Launches the tested application
  TestApp["Run"]();
}

See Also

Run Modes and Parameters
Editing Desktop Application Parameters
Activate Method
Name Property
About Tested Applications

Highlight search results