Prerequisites

In order to execute tests on Android devices marathon will need Android SDK installed. Devices are expected to be connected to local machine by any means supported by the adb (local usb connection, local emulator or TCP/IP).

Vendor specific options

To indicate that you’re using a vendor config for android you have to specify the type in the root of the Marathonfile configuration as following:

vendorConfiguration:
  type: "Android"
  additional_option1: ...
  additional_option2: ...

Required options

Android SDK path

If you’re using gradle plugin or CLI with ANDROID_HOME environment variable then this option is automatically detected. If this is not the case then you have to specify this option manually.

Marathonfile example:

androidSdk: "/usr/share/local/android"
Application APK path

If you’re using gradle plugin then this option is automatically detected. If this is not the case then you have to specify this option manually.

applicationApk: "app/build/outputs/apk/debug/app-debug.apk"
Test application APK path

If you’re using gradle plugin then this option is automatically detected. If this is not the case then you have to specify this option manually.

testApplicationApk: "app/build/outputs/apk/androidTest/debug/app-debug.apk"

Optional

Automatic granting of permissions

This option will grant all runtime permissions during the installation of the application. This works like the option -g for adb install command.

autoGrantPermission: true
ADB initialisation timeout

This option will allow you to increase/decrease the default adb init timeout of 30 seconds.

adbInitTimeoutMillis: 60000
Device serial number

This option allows to customise how marathon assigns a serial number to devices. Possible values are automatic, marathon_property, boot_property, hostname, ddms

serialStrategy: "automatic"
Install options

By default these will be -g -r (-r prior to marshmallow). You can specify additional options to append to the default ones.

installOptions: "-d"
Preferable recorder type

By default device will record a video if it is supported. If on the other hand you want to force screenshots for example you can specify this as follows:

preferableRecorderType: "screenshot"
Screen recording policy

By default the screen recording will be only stored for failed tests. This is to save space and also to reduce the test duration time since we’re not pulling additional files. If you need to save screen recording regardless of the test pass/failure please use the following:

screenRecordingPolicy: "ON_ANY"
Clear state between test executions

By default, marathon does not clear state between test batch executions. To mitigate potential test side-effects, one could add an option to clear the package data between test runs. Keep in mind that test side-effects might be present. If you want to isolate tests even further, then you should consider reducing the batch size.

applicationPmClear: true
testApplicationPmClear: true