Instrumenting Android Applications in Eclipse IDE

Applies to TestComplete 12.60, last modified on September 17, 2018

To create object-based Android tests, you need to instrument your tested Android application. This topic explains how you can do this with the Eclipse IDE.

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

Requirements

The instructions below assume that the Eclipse IDE is installed on your computer.

Preparation Steps

1. Include the PatchServices.jar Library In Your Project

  1. Open your Android project in the Eclipse IDE.

  2. Click Project | Properties to open the project’s properties and go to the Java Build Path.

  3. Open the Libraries tabbed page and click Add External JARs.

  4. Select PatchServices.jar. This file is located in the <TestComplete>\Bin\Extensions\Android folder.

  5. Important: Open the Order and Export tabbed page and select PatchServices.jar from the list:

    Click OK to save the changes.

2. Initialize the PatchServices Library When Application Starts

The main goal of this step is to initialize TestComplete tools when the application starts. There are two ways to do that. If your application includes more than one activity, you need to place the initializing line in the constructor of your application.

Java

public class MyApplication extends Application
{
    public MyApplication()
    {
        // The method that initializes TestComplete tools
        com.smartbear.uibinder.Binder.Initialize(this);
 
        …
    }
}

If there is only one activity in the tested application, you can add the initializing line to the onCreate method of the activity.

Java

public class MainActivity extends Activity
{
    protected void onCreate(Bundle savedInstanceState)
    {
        // The method that initializes TestComplete tools
        com.smartbear.uibinder.Binder.Initialize(getApplication());
 
        …
    }
}

3. Install TestComplete Android Agent

In order for TestComplete to be able to interact with your instrumented Android application, you need to install TestComplete Android Agent on your device. For complete information about the Agent and installation steps, see the Agent description.

See Also

Preparing for Testing Android Applications
Instrumenting Android Applications - Overview
Testing Android Applications - Overview

Highlight search results