Activate Method

Applies to TestComplete 15.46, last modified on January 09, 2023

Description

To modify parameters of tested applications defined in your projects, TestComplete offers special objects. These objects are collections that contain parameters specific to the application’s type or run mode. The Activate method is used to apply the needed parameter collection to an application.

Calling the method to apply a property collection corresponding to a run mode is similar to selecting a run mode in the Run Mode list of the TestedApps editor.

Declaration

ProgObj.Activate()

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

Applies To

The method is applied to the following objects:

Result Value

None.

Remarks

Important notes:

  • Calling this method will change the run mode value specified in the TestedApps editor for the tested application. TestComplete will treat your project as modified, so, you will have to save or cancel the changes when closing the project.

  • The TestedAppAIRParams, TestedAppClickOnce, TestedAppJavaParams and TestedAppWebParams parameter collections cannot be applied to a tested application programmatically. Add AIR, ClickOnce, Java and Web applications and modify their parameters via the TestComplete user interface.

Example

The following code snippet modifies parameters of the Simple run mode, activates the mode and launches the tested application.

JavaScript, JScript

function Test()
{
  var TestApp, SimpleParams;
  TestApp = TestedApps.Items("SampleApp");
  SimpleParams = TestApp.Params.SimpleParams;
  // Modifies the Simple run mode parameters
  SimpleParams.CommandLineParameters = "NotOpenApp";
  SimpleParams.WorkFolder = "D:\\Work Folder";

  // Applies the modified parameters and activates the Simple run mode
  SimpleParams.Activate();
  // Launches the tested application
  TestApp.Run();
}

Python

def Test():
  TestApp = TestedApps.Items("SampleApp")
  SimpleParams = TestApp.Params.SimpleParams
  # Modifies the Simple run mode parameters 
  SimpleParams.CommandLineParameters = "NotOpenApp"
  SimpleParams.WorkFolder = "D:\\Work Folder"
  # Applies the modified parameters and activates the Simple run mode 
  SimpleParams.Activate()
  # Launches the tested application 
  TestApp.Run()

VBScript

Sub Test
  Dim TestApp, SimpleParams
  Set TestApp = TestedApps.Items("SampleApp")
  Set SimpleParams = TestApp.Params.SimpleParams
  ' Modifies the Simple run mode parameters
  SimpleParams.CommandLineParameters = "NotOpenApp"
  SimpleParams.WorkFolder = "D:\Work Folder"

  ' Applies the modified parameters and activates the Simple run mode
  SimpleParams.Activate
  ' Launches the tested application
  TestApp.Run
End Sub

DelphiScript

procedure Test();
var TestApp, SimpleParams;
begin
  TestApp := TestedApps.Items('SampleApp');
  SimpleParams := TestApp.Params.SimpleParams;
  // Modifies the Simple run mode parameters
  SimpleParams.CommandLineParameters := 'NotOpenApp';
  SimpleParams.WorkFolder := 'D:\Work Folder';

  // Applies the modified parameters and activates the Simple run mode
  SimpleParams.Activate;
  // Launches the tested application
  TestApp.Run;
end;

C++Script, C#Script

function Test()
{
  var TestApp, SimpleParams;
  TestApp = TestedApps["Items"]("SampleApp");
  SimpleParams = TestApp["Params"]["SimpleParams"];
  // Modifies the Simple run mode parameters
  SimpleParams["CommandLineParameters"] = "NotOpenApp";
  SimpleParams["WorkFolder"] = "D:\\Work Folder";

  // Applies the modified parameters and activates the Simple run mode
  SimpleParams["Activate"]();
  // Launches the tested application
  TestApp["Run"]();
}

See Also

Run Modes and Parameters
Editing Desktop Application Parameters
IsActive Method
Name Property
TestedAppParams.ActiveParams
TestedAppSimpleParams Object
TestedAppRunAsParams Object
TestedAppDebugParams Object
TestedAppProfileParams Object
About Tested Applications

Highlight search results