About TestComplete Android Agent (Legacy)

Applies to TestComplete 15.47, last modified on January 20, 2023
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

TestComplete Android Agent is a helper application for testing Android applications with TestComplete.

General Information

The TestComplete Android Agent is a part of the TestComplete software package that is automatically installed on Android devices when you connect your device to TestComplete for the first time.

When the Agent is installed on a device, it runs as a service and provides helper functionality for the following tasks:

Important Notes:

  • In order for the Android Agent to be able to work on the device, emulator or virtual machine, it must have 512 MB of RAM or more.

  • To test Android Open Applications, you must have TestComplete Android Agent installed on your device. Otherwise, TestComplete will not be able to recognize the controls of your Open Application correctly.

Installing Android Agent

Automatic installation

To install the Agent, connect to the tested Android device. TestComplete will install the Android Agent automatically.

When the Agent is installed and is running, it displays its icon in the notification area of the main Android screen.

Note: If the Agent is not installed on the connected device, TestComplete displays a notification at the top of the Mobile Screen window suggesting to install the Agent.

Manual installation

Alternatively, you can deploy the Android Agent to the device manually. The Agent’s .apk file resides in the TestComplete installation folder. The full path is <TestComplete 15>\Bin\Extensions\Android\AndroidAgent.apk, where <TestComplete 15> is the TestComplete installation folder.

To deploy a package from tests, you can use the Install Package operation or the following script:

JavaScript, JScript

function InstallAgent()
{
  var AgentApkPath = "<TestComplete 15>\\Bin\\Extensions\\Android\\AndroidAgent.apk";
  var Agent = Mobile.Device().PackageManager.GetPackageFromAPK(AgentApkPath);
  Mobile.Device().PackageManager.InstallPackage(Agent);
}

Python

def InstallAgent():
  AgentApkPath = "<TestComplete 11>\\Bin\\Extensions\\Android\\AndroidAgent.apk";
  Agent = Mobile.Device().PackageManager.GetPackageFromAPK(AgentApkPath);
  Mobile.Device().PackageManager.InstallPackage(Agent);

VBScript

Sub InstallAgent
  AgentApkPath = "<TestComplete 15>\Bin\Extensions\Android\AndroidAgent.apk"
  Set Agent = Mobile.Device.PackageManager.GetPackageFromAPK(AgentApkPath)
  Mobile.Device.PackageManager.InstallPackage(Agent)
End Sub

DelphiScript

procedure InstallAgent();
var Agent, AgentApkPath;
begin
  AgentApkPath := '<TestComplete 15>\Bin\Extensions\Android\AndroidAgent.apk';
  Agent := Mobile.Device.PackageManager.GetPackageFromAPK(AgentApkPath);
  Mobile.Device.PackageManager.InstallPackage(Agent);
end;

C++Script, C#Script

function InstallAgent()
{
  var AgentApkPath = "<TestComplete 15>\\Bin\\Extensions\\Android\\AndroidAgent.apk";
  var Agent = Mobile["Device"]["PackageManager"]["GetPackageFromAPK"](AgentApkPath);
  Mobile["Device"]["PackageManager"]["InstallPackage"](Agent);
}

For more information about installation packages on the device, see Installing Packages on Devices (Legacy).

Android Agent GUI

To open the Android Agent GUI:

  • Expand the notification drawer of the main Android screen.

  • Touch the Android Agent notification.

-- or --

  • Touch Android Agent in the Apps list of the Android launcher.

From the Android Agent user interface, you can quickly access the Android device's settings that are important for application testing with TestComplete.

When the testing is over, remember to restore the default values of these settings.

Uninstalling Android Agent

If you no longer need the Android Agent, you can uninstall it as any other Android application:

  • Go to Settings | Apps screen on the mobile device.

  • Touch the Android Agent application in the list.

  • Press the Uninstall button in the ensuing App Info screen.

See Also

Testing Android Applications (Legacy)
About Testing Android Applications (Legacy)
Geolocation Testing (Legacy)

Highlight search results