UseRelativeWorkingFolder Property

Applies to TestComplete 15.47, last modified on January 20, 2023
This property is obsolete. See the Remarks section below.

Description

A tested application can be run in RunAs mode. The UseRelativeWorkingFolder property lets you determine or set whether TestComplete should use the absolute or relative path for the application’s working folder. TestComplete only uses this setting if the RunAs run mode is chosen for the application.

Declaration

TestedAppRunAsParamsObj.UseRelativeWorkingFolder

Read-Write Property Boolean
TestedAppRunAsParamsObj An expression, variable or parameter that specifies a reference to a TestedAppRunAsParams object

Applies To

The property is applied to the following object:

Property Value

True, if TestComplete uses the relative path to the tested application’s working folder. False, if it uses the absolute path to the working folder.

Remarks

The UseRelativeWorkingFolder property is obsolete and is not visible in the Code Completion window. This property will not be available in future releases.

If you assign a value to this property, TestComplete will treat your project as modified. So, you will need to save or cancel changes when closing the project.

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:
  // Specifies a command-line argument for the application
  RunAsParams.CommandLineParameters = "NotOpenApp";

  // Specifies a working folder for the tested application
  RunAsParams.WorkFolder = "D:\Work Folder";

  // Specifies that TestComplete uses a relative path to the tested application’s working folder
  RunAsParams.UseRelativeWorkingFolder = true;

  // 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 user 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: 
  # Specifies a command-line argument for the application 
  RunAsParams.CommandLineParameters = "NotOpenApp"
  # Specifies a working folder for the tested application 
  RunAsParams.WorkFolder = "D:\Work Folder"
  # Specifies that TestComplete uses a relative path to the tested application's working folder 
  RunAsParams.UseRelativeWorkingFolder = True
  # 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 user 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:
  ' Specifies a command-line argument for the application
  RunAsParams.CommandLineParameters = "NotOpenApp"

  ' Specifies a working folder for the tested application
  RunAsParams.WorkFolder = "D:\Work Folder"

  ' Specifies that TestComplete uses a relative path to the tested application’s working folder
  RunAsParams.UseRelativeWorkingFolder = True

  ' 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 user 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:
  // Specifies a command-line argument for the application
  RunAsParams.CommandLineParameters := 'NotOpenApp';

  // Specifies a working folder for the tested application
  RunAsParams.WorkFolder := 'D:\Work Folder';

  // Specifies that TestComplete uses a relative path to the tested application’s working folder
  RunAsParams.UseRelativeWorkingFolder := true;

  // 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 user 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 command-line argument for the application
  RunAsParams["CommandLineParameters"] = "NotOpenApp";

  // Specifies a working folder for the tested application
  RunAsParams["WorkFolder"] = "D:\Work Folder";

  // Specifies that TestComplete uses a relative path to the tested application’s working folder
  RunAsParams["UseRelativeWorkingFolder"] = true;

  // 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 user account
  TestApp["Run"]();

}

See Also

Run Modes and Parameters
Editing Desktop Application Parameters
WorkFolder Property
UseRelativeWorkingFolder Property
UseRelativeWorkingFolder Property
About Tested Applications

Highlight search results