KotlinMultiplatformAndroidTestOnDevice

Added in 8.2.0-beta03

@Incubating
interface KotlinMultiplatformAndroidTestOnDevice


Summary

Public functions

Unit
Unit
Unit

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

Unit

Configures Gradle Managed Devices for use in testing with the Unified test platform.

Unit
Unit

Public properties

Boolean

Disables animations during instrumented tests you run from the command line.

String?

The test application id.

EmulatorControl

Configures Android Emulator Grpc Access

EmulatorSnapshots

Configures Android Test Retention.

Boolean

Specifies code coverage is enabled for module tests of type AndroidTest.

String

Specifies whether to use on-device test orchestration.

Boolean?

See instrumentation.

Boolean?

See instrumentation.

Installation

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

String?

Test instrumentation runner class name.

MutableMap<String, String>

Test instrumentation runner custom arguments.

ManagedDevices

Configures Gradle Managed Devices for use in testing with the Unified test platform.

MultiDexConfig
ApkSigningConfig

Encapsulates signing configurations that you can apply to test APK

Public functions

emulatorControl

Added in 8.2.0-beta03
@Incubating
fun emulatorControl(action: EmulatorControl.() -> Unit): Unit

emulatorSnapshots

Added in 8.2.0-beta03
@Incubating
fun emulatorSnapshots(action: EmulatorSnapshots.() -> Unit): Unit

installation

Added in 8.2.0-beta03
@Incubating
fun installation(action: Installation.() -> Unit): Unit

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

For more information about the properties you can configure in this block, see Installation.

managedDevices

Added in 8.2.0-beta03
@Incubating
fun managedDevices(action: ManagedDevices.() -> Unit): Unit

Configures Gradle Managed Devices for use in testing with the Unified test platform.

multidex

Added in 8.2.0-beta03
@Incubating
fun multidex(action: MultiDexConfig.() -> Unit): Unit

signing

Added in 8.2.0-beta03
@Incubating
fun signing(action: ApkSigningConfig.() -> Unit): Unit

Public properties

animationsDisabled

Added in 8.2.0-beta03
var animationsDisabled: Boolean

Disables animations during instrumented tests you run from the command line.

If you set this property to true, running instrumented tests with Gradle from the command line executes am instrument with the --no-window-animation flag. By default, this property is set to false.

This property does not affect tests that you run using Android Studio. To learn more about running tests from the command line, see Test from the Command Line.

applicationId

Added in 8.2.0-beta03
var applicationId: String?

The test application id.

emulatorControl

Added in 8.2.0-beta03
val emulatorControl: EmulatorControl

Configures Android Emulator Grpc Access

Android Emulator Grpc Access will make it possible to interact with the emulator over gRPC

emulatorControl {
enable true
secondsValid 180
allowedEndpoints.addAll(
"/android.emulation.control.EmulatorController/getStatus",
"/android.emulation.control.EmulatorController/getVmState")
}

emulatorSnapshots

Added in 8.2.0-beta03
val emulatorSnapshots: EmulatorSnapshots

Configures Android Test Retention.

Android Test Retention automatically takes emulator snapshots on test failures. It can only work with Unified Test Platform (UTP).

emulatorSnapshots {
enableForTestFailures true
maxSnapshotsForTestFailures 2
compressSnapshots false
}

enableCoverage

Added in 8.2.0-beta03
var enableCoverage: Boolean

Specifies code coverage is enabled for module tests of type AndroidTest.

If enabled, prepares module class files for code coverage collection such as instrumenting dependent library classes and module classes. This allows for code coverage reports to be generated.

execution

Added in 8.2.0-beta03
var execution: String

Specifies whether to use on-device test orchestration.

If you want to use Android Test Orchestrator you need to specify "ANDROID_TEST_ORCHESTRATOR", as shown below. By default, this property is set to "HOST", which disables on-device orchestration.

functionalTest

Added in 8.2.0-beta03
var functionalTest: Boolean?

See instrumentation.

handleProfiling

Added in 8.2.0-beta03
var handleProfiling: Boolean?

See instrumentation.

installation

Added in 8.2.0-beta03
val installation: Installation

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

For more information about the properties you can configure in this block, see Installation.

instrumentationRunner

Added in 8.2.0-beta03
var instrumentationRunner: String?

Test instrumentation runner class name. This is a fully qualified class name of the runner See instrumentation.

instrumentationRunnerArguments

Added in 8.2.0-beta03
val instrumentationRunnerArguments: MutableMap<String, String>

Test instrumentation runner custom arguments.

e.g. [key: "value"] will give adb shell am instrument -w -e key value com.example...

See instrumentation.

Test runner arguments can also be specified from the command line:

./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.size=medium
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.foo=bar

managedDevices

Added in 8.2.0-beta03
val managedDevices: ManagedDevices

Configures Gradle Managed Devices for use in testing with the Unified test platform.

multidex

Added in 8.2.0-beta03
val multidex: MultiDexConfig

signing

Added in 8.2.0-beta03
val signing: ApkSigningConfig

Encapsulates signing configurations that you can apply to test APK

For more information about the properties you can configure in this block, see ApkSigningConfig.