Skip to main content

Preparing your App and Test .apk Files

This section assumes that you have a fully working Android application from a fully configured Android project. 

The first thing you should do is create some tests for your app. To do so, you can simply use Android Studio's Built-in Test Recorder:

In Android Studio, click on Run → Record Espresso Test.

Record Espresso Test

Select a device to test on. 

This will install and launch the app on the device.

Select a Device

Interact with the app in order for the steps to be recorded

When you are done, click on OK and give the test class a name that reflects the test. 

You should end up with a test class that looks like the one appearing in the screenshot below:

Record the Steps

Now that you have some test classes, you are ready to bundle them as .apk. Since Android Studio is using Gradle, you can run the following commands in the terminal to create the .apk files for both your app and the test classes:

To create a .apk file for the app

In the terminal run the following command:

gradlew assembleDebug

Alternatively, you can build the .apk using Android Studio's GUI: Click on Build → Build APK.

To create a .apk file for the test classes

In the terminal run the following command:

gradlew assembleAndroidTest

Find both .apk files under your project folder: <project-folder>\build\outputs\apk. In the apk folder you will find two files:

  • app-debug.apk
  • app-debug-androidTest.apk

These are the files that you will upload to the cloud when you create your Execution Plan.