Preparing Android Applications (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.

Since the 14.70 version, TestComplete instruments Android applications automatically when running them from the Tested Applications collection.

To expose “native” methods, properties, and fields of Android controls to TestComplete, you need to instrument your Android application (that is, prepare it for testing). We call instrumented Android applications white-box or Android Open Applications as they are “open” to TestComplete.

Instrumentation means running an Android application with the special PatchServices.jar library injected. Android applications can be instrumented automatically or manually.

Automatic instrumentation

TestComplete automatically instruments Android applications added to the Tested Applications collection of your project. It instruments them automatically when you run these applications from your test or from the TestComplete UI.

To add an application to the Tested Applications collection, use the TestedApps editor or the TestedApps.AddAndroidApp(…) method.

During the instrumentation, TestComplete does not change the application’s source or binary code. So, you do not need to create a separate build configuration for testing, you can use your “production” configuration, for example.

Manual instrumentation

Alternatively, you can do all the preparation actions manually in the Eclipse IDE or Android Studio. Follow these links for detailed information:

Do not submit instrumented in such way applications to Google Play. Applications use private APIs and will be rejected. Create a separate build configuration for test builds.

For Android 11

For TestComplete to be able to expose applications built with Android SDK 30 for Android version 11, configure the application to allow the TestComplete Android Agent to access it. To do this, recompile the application with one of the following added to the application’s manifest file:

AndroidManifest.xml

<queries>
  <package android:name="com.smartbear.androidagent"/>
</queries>

– or –

AndroidManifest.xml

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

Other preparatory actions

To test Android applications with TestComplete, you should also prepare the computer where TestComplete is running and prepare your Android device, emulator, or virtual machine. For complete information on this, see the topics of the following section:

See Also

Testing Android Applications (Legacy)

Highlight search results