About TestComplete Android Agent

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

TestComplete Android Agent is a helper application used to simplify testing of Android applications with TestComplete.

General Information

TestComplete Android Agent is part of the TestComplete software package that is installed on Android devices.

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

To install the Agent:

  • Connect to the tested Android device.

  • Open the Mobile Screen window.

    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.

  • Click the Enable link in the notification.

    -- or --

    Press the Install Android Agent button on the toolbar.

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 14>\Bin\Extensions\Android\AndroidAgent.apk, where <TestComplete 14> 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 14>\\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 14>\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 14>\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 14>\\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.

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

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
About Testing Android Applications
Geolocation Testing

Highlight search results