APKFileName Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

Use the APKFileName property to get or set the path to the Android application package file (APK).

Declaration

AndroidTestedAppObj.APKFileName

Read-Write Property String
AndroidTestedAppObj An expression, variable or parameter that specifies a reference to an AndroidTestedApp object

Applies To

The property is applied to the following object:

Property Value

A string containing the fully-qualified path to the Android application package file.

Example

The following sample script demonstrates how to add an Android application to the list of tested applications, modify the path to its package file and launch the application.

JavaScript, JScript

function AddAndroidApplication()
{

  // Sets the current device
  Mobile.SetCurrent("MyDevice");

  // Adds an Android application to the list of tested applications
  var ind = TestedApps.AddAndroidApp("C:\\Apps\\DemoApp.apk");

  // Obtains the tested application and modifies the path to its package file
  var AndroidTestedApp = TestedApps.Items(ind);
  AndroidTestedApp.APKFileName = "C:\\Apps\\AndroidApp.apk";
  …

  // Launches the application
  AndroidTestedApp.DeployOnStart = true;
  AndroidTestedApp.Run();

}

Python

def AddAndroidApplication():
  # Sets the current device 
  Mobile.SetCurrent("MyDevice")
  # Adds an Android application to the list of tested applications 
  ind = TestedApps.AddAndroidApp("C:\\Apps\\DemoApp.apk")
  # Obtains the tested application and modifies the path to its package file 
  AndroidTestedApp = TestedApps.Items[ind]
  AndroidTestedApp.APKFileName = "C:\\Apps\\AndroidApp.apk"
  # ...
  # Launches the application 
  AndroidTestedApp.DeployOnStart = True
  AndroidTestedApp.Run()

VBScript

Sub AddAndroidApplication

  ' Sets the current device
  Mobile.SetCurrent("MyDevice")

  ' Adds the Android application to the list of tested applications
  ind = TestedApps.AddAndroidApp("C:\Apps\DemoApp.apk")

  ' Obtains the tested application and modifies the path to its package file
  Set AndroidTestedApp = TestedApps.Items(ind)
  AndroidTestedApp.APKFileName = "C:\Apps\AndroidApp.apk"
  …

  ' Launches the application
  AndroidTestedApp.DeployOnStart = True
  AndroidTestedApp.Run

End Sub

DelphiScript

procedure AddAndroidApplication();
var ind, AndroidTestedApp;
begin

  // Sets the current device
  Mobile.SetCurrent('MyDevice');

  // Adds the Android application to the list of tested applications
  ind := TestedApps.AddAndroidApp('C:\Apps\DemoApp.apk');

  // Obtains the tested application and modifies the path to its package file
  AndroidTestedApp := TestedApps.Items[ind];
  AndroidTestedApp.APKFileName := 'C:\Apps\AndroidApp.apk';
  …

  // Launches the application
  AndroidTestedApp.DeployOnStart := true;
  AndroidTestedApp.Run();

end;

C++Script, C#Script

function AddAndroidApplication()
{

  // Sets the current device
  Mobile["SetCurrent"]("MyDevice");

  // Adds an Android application to the list of tested applications
  var ind = TestedApps["AddAndroidApp"]("C:\\Apps\\DemoApp.apk");

  // Obtains the tested application and modifies the path to its package file
  var AndroidTestedApp = TestedApps["Items"](ind);
  AndroidTestedApp["APKFileName"] = "C:\\Apps\\AndroidApp.apk";
  …

  // Launches the application
  AndroidTestedApp["DeployOnStart"] = true;
  AndroidTestedApp["Run"]();

}

See Also

AndroidTestedApp Object
About Tested Android Applications (Legacy)
About Tested Applications
Run Modes and Parameters
Editing Mobile Application Parameters From Tests

Highlight search results