KotlinMultiplatformAndroidTestOnDevice

@Incubating interface KotlinMultiplatformAndroidTestOnDevice


Summary

Public functions

@Incubating Unit
@Incubating Unit
@Incubating Unit

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

@Incubating Unit

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

@Incubating Unit
@Incubating 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<StringString>

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

@Incubating
fun emulatorControl(action: @ExtensionFunctionType EmulatorControl.() -> Unit): Unit

emulatorSnapshots

@Incubating
fun emulatorSnapshots(action: @ExtensionFunctionType EmulatorSnapshots.() -> Unit): Unit

installation

@Incubating
fun installation(action: @ExtensionFunctionType 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

@Incubating
fun managedDevices(action: @ExtensionFunctionType ManagedDevices.() -> Unit): Unit

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

Public properties

animationsDisabled

var animationsDisabledBoolean

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

var applicationIdString?

The test application id.

emulatorControl

val emulatorControlEmulatorControl

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

val emulatorSnapshotsEmulatorSnapshots

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

var enableCoverageBoolean

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

var executionString

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

var functionalTestBoolean?

See instrumentation.

handleProfiling

var handleProfilingBoolean?

See instrumentation.

installation

val installationInstallation

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

var instrumentationRunnerString?

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

instrumentationRunnerArguments

val instrumentationRunnerArgumentsMutableMap<StringString>

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

val managedDevicesManagedDevices

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

multidex

val multidexMultiDexConfig

signing

val signingApkSigningConfig

Encapsulates signing configurations that you can apply to test APK

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