TestedAppParams.RunAsParams

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

A tested application can be run in various modes. Use the RunAsParams property to obtain access to the parameters specific to the RunAs run mode. The TestComplete engine will use these parameters to launch a tested application, if RunAs run mode is chosen for this application.

Declaration

TestedAppParamsObj.RunAsParams

Read-Only Property The TestedAppRunAsParams object
TestedAppParamsObj An expression, variable or parameter that specifies a reference to a TestedAppParams object

Applies To

The property is applied to the following object:

Property Value

The TestedAppRunAsParams object that provides a scripting interface to the parameters of the RunAs run mode.

Example

The following example demonstrates how to modify the tested application’s parameters in script:

JavaScript, JScript

function Test()
{

  var TestApp, Params, RunAsParams;
  TestApp = TestedApps.Items("SampleApp");
  // Obtains the tested application's parameters
  Params = TestApp.Params;
  // Obtains the parameters of the RunAs mode
  RunAsParams = Params.RunAsParams;

  // Modifies the parameters of the RunAs mode:
  RunAsParams.Domain = "CompanyDomain";

  RunAsParams.UserName = "jsmith";

  RunAsParams.Password = "jsmithpswrd";

  // Applies the modified parameters and activates the RunAs mode
  RunAsParams.Activate();

  // Launches the tested application in the RunAs mode under the specified account
  TestApp.Run();

}

Python

def Test():
  TestApp = TestedApps.Items["SampleApp"]
  # Obtains the tested application's parameters
  Params = TestApp.Params
  # Obtains the parameters of the RunAs mode
  RunAsParams = Params.RunAsParams
  # Modifies the parameters of the RunAs mode:
  RunAsParams.Domain = "CompanyDomain"
  RunAsParams.UserName = "jsmith"
  RunAsParams.Password = "jsmithpswrd"
  # Applies the modified parameters and activates the RunAs mode
  RunAsParams.Activate()
  # Launches the tested application in the RunAs mode under the specified account
  TestApp.Run()

VBScript

Sub Test

  Dim TestApp, Params, RunAsParams
  Set TestApp = TestedApps.Items("SampleApp")
  ' Obtains the tested application's parameters
  Set Params = TestApp.Params
  ' Obtains the parameters of the RunAs mode
  Set RunAsParams = Params.RunAsParams

  ' Modifies the parameters of the RunAs mode:
  RunAsParams.Domain = "CompanyDomain"

  RunAsParams.UserName = "jsmith"

  RunAsParams.Password = "jsmithpswrd"

  ' Applies the modified parameters and activates the RunAs mode
  RunAsParams.Activate

  ' Launches the tested application in the RunAs mode under the specified account
  TestApp.Run

End Sub

DelphiScript

procedure Test();
var TestApp, Params, RunAsParams;
begin

  TestApp := TestedApps.Items('SampleApp');
  // Obtains the tested application's parameters
  Params := TestApp.Params;
  // Obtains the parameters of the RunAs mode
  RunAsParams := Params.RunAsParams;

  // Modifies the parameters of the RunAs mode
  RunAsParams.Domain := 'CompanyDomain';

  RunAsParams.UserName := 'jsmith';

  RunAsParams.Password := 'jsmithpswrd';

  // Applies the modified parameters and activates the RunAs mode
  RunAsParams.Activate;

  // Launches the tested application in the RunAs mode under the specified account
  TestApp.Run;

end;

C++Script, C#Script

function Test()
{

  var TestApp, Params, RunAsParams;
  TestApp = TestedApps["Items"]("SampleApp");
  // Obtains the tested application's parameters
  Params = TestApp["Params"];
  // Obtains the parameters of the RunAs mode
  RunAsParams = Params["RunAsParams"];

  // Modifies the parameters of the RunAs mode
  // Specifies a domain for the user account under which the application will be run
  RunAsParams["Domain"] = "CompanyDomain";

  // Specifies the user account under which the application will be run
  RunAsParams["UserName"] = "jsmith";

  // Specifies a password for the user account under which the application will be run
  RunAsParams["Password"] = "jsmithpswrd";

  // Applies the modified parameters and activates the RunAs mode
  RunAsParams["Activate"]();

  // Launches the tested application in the RunAs mode under the specified account
  TestApp["Run"]();

}

See Also

Run Modes and Parameters
Editing Desktop Application Parameters
TestedAppRunAsParams Object
Testing Applications Running Under Another User Account
TestedAppParams.ActiveParams
TestedAppParams.DebugParams
TestedAppParams.ProfileParams
TestedAppParams.SimpleParams
About Tested Applications

Highlight search results