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:
-
Exchanging data with Android Open applications. See Preparing Android Applications.
-
Simulating input of local (national) symbols. See Simulating Local Symbol Input.
-
Retrieving data from the built-in sensors of the device. See Getting Data From Mobile Device Sensors.
-
Retrieving and emulating data obtained from the GPS receiver of the device. See Geolocation Testing.
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 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.
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