Skip to main content

Mobile testing using an Android emulator

Learn how to perform mobile testing in Katalon Studio using an Android emulator.

The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device. To learn more about the Android emulator capabilities and system requirements, you can refer to this Android developer document: Run apps on the Android Emulator.

When performing mobile testing using an Android emulator in Katalon Studio, you can test as if you were using a real Android device or iOS device. However, you need to follow these pre-testing steps:

  1. Install Appium and WebDriver: You need Appium 2.x to connect Katalon Studio with your emulator.

  2. Install Android Studio: Android Studio allows developers to build high-quality applications for the Android platform. You will be using this platform to create your emulator.

  3. Create and launch your emulator: Using Android Studio, create and launch your emulator according to your emulator and use case specifications.

  4. Ensure you have the correct Android SDK installed: This is to ensure that you can run your app compatible with the emulator you created in Android Studio. Refer to the following link to secure the Android SDK version for testing: [Download] Android release versions.

Install Appium 2.x and WebDriver

Follow the steps to install Appium 2.x and other dependencies.

  1. Download and install Node.js 14+.
    Note:

    Make sure you install Node.js into a location with full Read/Write permission.

  2. Download and install Node Package Manager 8+ (NPM). This is usually bundled with Node.js, but you can upgrade independently.
  3. Download and install the latest version of Appium (2.x and later) using NPM. Copy and paste the command-line argument as follows:
    npm install -g appium
    Note:

    Some emulators support Appium directly when installed. If you want to run an application on an emulator, check your emulator settings before installing Appium.

  4. Installing Appium 2.x only installs the Appium server, but not the WebDriver. Install the recommended version of the Appium UiAutomator2 Driver (version 2.45.1). The Appium UiAutomator2 Driver for Android native and web apps (via hybrid mode) is based on the Google UiAutomator framework.
    Execute the following command:
    appium driver install uiautomator2@2.45.1
You have installed Appium 2.x server and WebDriver. Scroll down or click on the link to start creating your Android emulator: Install Android Studio.

Create an emulator

Create your Android emulator using Android Studio. Follow the steps to do so.

Install Android Studio

Download and install Android Studio. You can download Android Studio from the Android developer website here: Android Studio.

Next, create an Android Studio project for your new emulator. See: Create an emulator project in Android Studio.

Create an emulator project in Android Studio

Follow the steps to create a new project in Android Studio for your emulator.

Creating a new project in Android Studio allows you to "build" your Android emulator using a set of sample files. The Android emulator, in this context, is considered an app.
  1. After installing Android Studio, select New Project on the Welcome Page. Select Android Studio provides a variety of sample projects for you to choose from. Here, we choose Empty Activity as an example, then click Next.
  2. Select Phone and Tablet then Empty Activity and click Next. Choose Android Studio project template Phone and Tablet > Empty Activity.

  3. In the New Project modal window, enter the following configuration:
    Name The name of your project.
    Package Name By default, this is generated as com.example.<projectname>.
    Save location The file location where you want to save your project. In case you want to change the default location, click Browse (folder icon).
    Language The language to build your Android app. You can select either Java or Kotlin from the dropdown menu.
    Minimum SDK Enter the lowest version of Android supported by your app.
    Use legacy android.support libraries If your app requires legacy library support, tick this box.

    To learn more about Android support libraries, refer to the Android developer document here: Support libraries.

    Here is a sample configuration for an Android emulator project: Configure your Android Studio project.

  4. Click Finish.
A new project window opens containing sample files to build your Android emulator app.

To learn more about building an Android app, you can refer to this Android developer document: Build a simple user interface.

Next, use the project files to create your Android emulator. See: Create your Android emulator.

Create your Android emulator

Create your Android emulator using Android Studio. Follow the steps to do so.

  1. Open Android Studio and your new emulator project.
  2. In the main toolbar of the new project window, select Device manager. Select Device Manager.

    This opens up the Android Virtual Device Manager.
  3. In Android Virtual Device Manager, click Create Device.
    This opens up the Virtual Device Configuration window.
  4. By default, Select Hardware is selected. Select your emulator's screen size, resolution, and pixel density. To get an overview about screen variations, refer to this Android developer document: Screen compatibility overview. Select the hardware

  5. After selecting the hardware, click Next.
  6. Select the system image for a particular API level or an Android version. Click Download next to the system image you select to download the applicable Android SDK.
    Note:
    • Katalon Studio can only support Android version 6.0 or later. To learn more about the supported environment in Katalon Studio, Refer to this document: Supported environment.

    • You need to accept Android Software Development Kit License Agreement, then click Next to start downloading.

    In the example below, we selected Phone > Pixel 5 and x86 system image, which prompted Android Studio to select Pie for download. Pie is the code name for Android version 9.0 and API level 28. Select system image and download SDK.

    To learn more about Android versions and the corresponding API levels, refer to the Android developer document here: Understanding Android API levels.

  7. After choosing the system image, click Next.
  8. The Verify Configuration page appears. Change the default name of your emulator if necessary, then click Finish.
Open Android Virtual Device Manager from the main menu and verify if your new Android emulator is successfully created. View your new Android emulator.

Launch an emulator

Use the Android Virtual Device Manager to launch your newly-created Android emulator.

To launch an emulator, open the Device Manager, select the emulator you want to launch, then click the Run icon.
Note:

If you want to run the emulator via the command-line option, you can refer to the Android developer document here: Start the emulator from the command line.

View your new Android emulator.

The Android Emulator is opened in another modal window.

Launch the Android emulator.

Verify successful Android device connection in Katalon Studio

After launching your newly-created emulator, Katalon automatically recognizes it as an Android device.

To check whether Katalon successfully recognizes your Android emulator, we recommend doing a test run using our sample Android Mobile Tests Project. Here's how:

  1. Open a Mobile Testing Sample Project in File > New sample projects and select Sample Android Mobile Tests Project. Open Android sample project

  2. Select a test case inside the Test Cases folder.
  3. On the main toolbar, select Android in the dropdown list next to the Run icon. Regconize Android devices

  4. You should see the name of your emulator appear as an Android device.
    Note:

    You must first manually launch the emulator with Android Studio or via the command-line option for Katalon to recognize the device.

    Choose emulator in Katalon

Verify successful Android device connection

Learn how to verify a successful Android device connection in Katalon Studio.

After launching your newly-created emulator, Katalon automatically recognizes it as an Android device.

To check whether Katalon successfully recognizes your Android emulator, we recommend doing a test run using our sample Android Mobile Tests Project. Here's how:
  1. Open a Mobile Testing Sample Project in File > New sample projects and select Sample Android Mobile Tests Project. Open Android sample project

  2. Select a test case inside the Test Cases folder.
  3. On the main toolbar, select Android in the dropdown list next to the Run icon. Recognize Android devices.

  4. You should see the name of your emulator appear as an Android device. Choose emulator in Katalon

    Note: You must first manually launch the emulator with Android Studio or via the command-line option for Katalon to recognize the device.
Congratulations! ou may now proceed to recording a mobile test using your Android emulator. See the following cookbook topic for more information: Record a mobile test case.
Was this page helpful?