FileName Property

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

The FileName property specifies the file name (with extension) of the executable that launches the tested application. The file name does not include the path which you can get or set separately using the Path property. To get the fully-qualified file name, use the FullFileName property.

The executable file in question is the one specified in the Command line string at the bottom of the TestedApps editor. Note that this is not necessarily the application file (see the Property Value section below).

Declaration

TestedAppObj.FileName

Read-Write Property String
TestedAppObj An expression, variable or parameter that specifies a reference to a TestedApp object

Applies To

The property is applied to the following object:

Property Value

The name of the executable file that launches the tested application.

For generic Windows applications with the Simple, RunAs, Profile or Debug run mode, the FileName property holds the application’s executable file name.

For Java applications, the FileName property holds the file name of the Java Virtual Machine launcher used for the application - java.exe or javaw.exe.

For AIR applications launched via AIR Debug Launcher, the FileName property holds adl.exe.

For ClickOnce applications, the FileName property holds rundll32.exe.

For web applications, the FileName property holds the browser file name.

Example

The following example demonstrates how to change the name of the tested application’s executable file from script:

JavaScript, JScript

function Test()
{

  var TestApp, FileName, Path;
  // Obtains the tested application
  TestApp = TestedApps.Items(0);
  // Specifies the name of the executable
  FileName = "Orders.exe";
  // Specifies the path to the executable
  Path = "D:\\Work Folder";
  // Sets a new tested application executable file name and path
  TestApp.FileName = FileName;
  TestApp.Path = Path;
  // Launches the tested application
  TestApp.Run();

}

Python

def Test():
  # Obtains the tested application
  TestApp = TestedApps.Items[0]
  # Specifies the name of the executable
  FileName = "Orders.exe"
  # Specifies the path to the executable
  Path = "D:\\Work Folder"
  # Sets a new tested application executable file name and path
  TestApp.FileName = FileName
  TestApp.Path = Path
  # Launches the tested application
  TestApp.Run()

VBScript

Sub Test

  Dim TestApp, FileName, Path
  ' Obtains the tested application
  Set TestApp = TestedApps.Items(0)
  ' Specifies the name of the executable
  FileName = "Orders.exe"
  ' Specifies the path to the executable
  Path = "D:\Work Folder"
  ' Sets a new tested application executable file name and path
  TestApp.FileName = FileName
  TestApp.Path = Path
  ' Launches the tested application
  TestApp.Run

End Sub

DelphiScript

procedure Test();
var TestApp, FileName, Path;
begin

  // Obtains the tested application
  TestApp := TestedApps.Items(0);
  // Specifies the name of the executable
  FileName := 'Orders.exe';
  // Specifies the path to the executable
  Path := 'D:\Work Folder';
  // Sets a new tested application executable file name and path
  TestApp.FileName := FileName;
  TestApp.Path := Path;
  // Launches the tested application
  TestApp.Run;

end;

C++Script, C#Script

function Test()
{

  var TestApp, FileName, Path;
  // Obtains the tested application
  TestApp = TestedApps["Items"](0);
  // Specifies the name of the executable
  FileName = "Orders.exe";
  // Specifies the path to the executable
  Path = "D:\\Work Folder";
  // Sets a new tested application executable file name and path
  TestApp["FileName"] = FileName;
  TestApp["Path"] = Path;
  // Launches the tested application
  TestApp["Run"]();

}

See Also

ItemName Property
Path Property
FullFileName Property
Parameters Property
WorkFolder Property
Run Method
RunAll Method

Highlight search results