Automating the Web application testing process in Android

You can automate the process of testing web applications in Android apps with several command line tools, the Android Debug Bridge (adb), and the USB Controller. The USB Controller also makes it possible to test in secure environments.

Before you begin

  • Download and install adb, which is part of Android SDK Tools, on the computer running the test workbench. The current download page is at Android Studio but the location could change in the future. You do not need to install the full Android Studio. Just navigate to the SDK Tools Only section under Other Download Options to obtain the installer. Make sure your device is correctly setup for adb by executing the adb devices command.
  • To test on Android emulators, set up one or more AVD (Android Virtual Device) configurations. For details, see Using the Emulator. This article also describes ways to improve emulator performance through hardware acceleration.
  • To test on Android devices, enable USB debugging by going to Settings > Developer options on an Android device. Then, connect the Android device with a USB cable to the computer that is running the test workbench. If necessary, obtain the specific USB driver for your device from or go to the web site of the device vendor.
  • As an alternative for testing on Android devices, you can use the USB Controller, which provides silent install mode on Android devices and emulators, regardless of the API level, and also allows you to work in secure environments that have no WiFi access. With the USB Controller, you can also work in an environment where the test workbench is remote. See Installing and configuring the Android client with the USB Controller for details.
  • Record the test scripts for the application under test (AUT). The test recording process cannot be automated. See Recording tests from the Android mobile test client for details.

About this task

The automation process includes the following procedures:

  • Installing the mobile test client on an Android device and starting it in passive mode
  • Running the test from the command line or by using the UrbanCode Deploy plugin


  1. Install the mobile test client and start it in passive mode. Passive mode allows text execution to be controlled by a script or batch file in the test workbench. Run the following adb commands to uninstall an existing version of the mobile test client, reinstall a newer version of the client, and set the client to passive mode.
    adb uninstall
    adb install "Eclipse client path/"
    adb shell am start -n -e workbench_url "Workbench-Url" --ez passive_mode “true”

    For example:

    adb uninstall
    adb install "C:\Program Files\HCL\HCLIMShared\"
    adb shell am start -n -e workbench_url "" --ez passive_mode “true”
  2. If you want to automate tests of mobile web applications, you must ensure that the Mobile Web Recorder is installed on the mobile test client. If the mobile test client is set up to run silent mode with the USB Controller, the Mobile Web Recorder will be installed automatically when the test run starts. No user action is required. However, if silent install is not set up, you must install the Mobile Web Recorder by tapping Manage Web Applications once in the mobile test client. This will initiate the installation of the two required apks and fulfill the requirements for automated test playback of a web app.
  3. Run a test in command line mode. For details about running a test or schedule in command line mode, see Running a test or schedule from the command line.

    If your automated testing requires the test workbench to be stopped and re-started, you can enable the Do not quit when workbench exits setting in the USB Controller to keep the USB Controller running even after the test workbench is closed. For details, see USB Controller.

    By default, the test workbench selects the first connected device that best fits the test execution requirements (Android OS and Android API). To run the test on one or more specific devices, define the Device ID selection variable. To find the Device ID, open the Mobile Devices editor in the test workbench, select a device, and look for the ID in Detailed Properties.

    You can also use a variable to select a specific device. For details, see Defining a variable to run a test with a selected mobile device.

  4. As an alternative to running a test in command line mode, you can run a test using the UrbanCode Deploy plugin for HCL OneTest Studio. For more information, see, Testing from UrbanCode Deploy.