KotlinMultiplatformAndroidTestOnDevice
@Incubating interface KotlinMultiplatformAndroidTestOnDevice
Summary
Public functions |
|
---|---|
@Incubating Unit |
emulatorControl(action: @ExtensionFunctionType EmulatorControl.() -> Unit) |
@Incubating Unit |
emulatorSnapshots(action: @ExtensionFunctionType EmulatorSnapshots.() -> Unit) |
@Incubating Unit |
installation(action: @ExtensionFunctionType Installation.() -> Unit) Specifies options for the Android Debug Bridge (ADB), such as APK installation options. |
@Incubating Unit |
managedDevices(action: @ExtensionFunctionType ManagedDevices.() -> Unit) Configures Gradle Managed Devices for use in testing with the Unified test platform. |
@Incubating Unit |
multidex(action: @ExtensionFunctionType MultiDexConfig.() -> Unit) |
@Incubating Unit |
signing(action: @ExtensionFunctionType ApkSigningConfig.() -> 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
@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 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.
emulatorControl
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
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
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
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.
installation
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
var instrumentationRunner: String?
Test instrumentation runner class name. This is a fully qualified class name of the runner See instrumentation.
instrumentationRunnerArguments
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
val managedDevices: ManagedDevices
Configures Gradle Managed Devices for use in testing with the Unified test platform.
signing
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
.