KotlinMultiplatformAndroidTestOnDevice

@Incubating
public interface KotlinMultiplatformAndroidTestOnDevice


Summary

Public methods

abstract void
abstract void
abstract boolean

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

abstract String

The test application id.

abstract @NonNull EmulatorControl

Configures Android Emulator Grpc Access

abstract @NonNull EmulatorSnapshots

Configures Android Test Retention.

abstract boolean

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

abstract @NonNull String

Specifies whether to use on-device test orchestration.

abstract Boolean

See instrumentation.

abstract Boolean

See instrumentation.

abstract @NonNull Installation

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

abstract String

Test instrumentation runner class name.

abstract @NonNull Map<@NonNull String, @NonNull String>

Test instrumentation runner custom arguments.

abstract @NonNull ManagedDevices

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

abstract @NonNull MultiDexConfig
abstract @NonNull ApkSigningConfig

Encapsulates signing configurations that you can apply to test APK

abstract void

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

abstract void

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

abstract void
abstract void
@Incubating
setAnimationsDisabled(boolean animationsDisabled)

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

abstract void

The test application id.

abstract void
@Incubating
setEnableCoverage(boolean enableCoverage)

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

abstract void

Specifies whether to use on-device test orchestration.

abstract void

See instrumentation.

abstract void

See instrumentation.

abstract void

Test instrumentation runner class name.

abstract void

Public methods

emulatorControl

@Incubating
abstract void emulatorControl(
    @ExtensionFunctionType @NonNull Function1<@NonNull EmulatorControlUnit> action
)

emulatorSnapshots

@Incubating
abstract void emulatorSnapshots(
    @ExtensionFunctionType @NonNull Function1<@NonNull EmulatorSnapshotsUnit> action
)

getAnimationsDisabled

@Incubating
abstract boolean getAnimationsDisabled()

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.

getApplicationId

@Incubating
abstract String getApplicationId()

The test application id.

getEmulatorControl

@Incubating
abstract @NonNull EmulatorControl getEmulatorControl()

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")
}

getEmulatorSnapshots

@Incubating
abstract @NonNull EmulatorSnapshots getEmulatorSnapshots()

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
}

getEnableCoverage

@Incubating
abstract boolean getEnableCoverage()

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.

getExecution

@Incubating
abstract @NonNull String getExecution()

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.

getFunctionalTest

@Incubating
abstract Boolean getFunctionalTest()

See instrumentation.

getHandleProfiling

@Incubating
abstract Boolean getHandleProfiling()

See instrumentation.

getInstallation

@Incubating
abstract @NonNull Installation getInstallation()

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.

getInstrumentationRunner

@Incubating
abstract String getInstrumentationRunner()

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

getInstrumentationRunnerArguments

@Incubating
abstract @NonNull Map<@NonNull String, @NonNull StringgetInstrumentationRunnerArguments()

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

getManagedDevices

@Incubating
abstract @NonNull ManagedDevices getManagedDevices()

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

getMultidex

@Incubating
abstract @NonNull MultiDexConfig getMultidex()

getSigning

@Incubating
abstract @NonNull ApkSigningConfig getSigning()

Encapsulates signing configurations that you can apply to test APK

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

installation

@Incubating
abstract void installation(
    @ExtensionFunctionType @NonNull Function1<@NonNull InstallationUnit> action
)

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
abstract void managedDevices(
    @ExtensionFunctionType @NonNull Function1<@NonNull ManagedDevicesUnit> action
)

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

multidex

@Incubating
abstract void multidex(
    @ExtensionFunctionType @NonNull Function1<@NonNull MultiDexConfigUnit> action
)

setAnimationsDisabled

@Incubating
abstract void setAnimationsDisabled(boolean animationsDisabled)

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.

setApplicationId

@Incubating
abstract void setApplicationId(String applicationId)

The test application id.

setEnableCoverage

@Incubating
abstract void setEnableCoverage(boolean enableCoverage)

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.

setExecution

@Incubating
abstract void setExecution(@NonNull String execution)

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.

setFunctionalTest

@Incubating
abstract void setFunctionalTest(Boolean functionalTest)

See instrumentation.

setHandleProfiling

@Incubating
abstract void setHandleProfiling(Boolean handleProfiling)

See instrumentation.

setInstrumentationRunner

@Incubating
abstract void setInstrumentationRunner(String instrumentationRunner)

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

signing

@Incubating
abstract void signing(
    @ExtensionFunctionType @NonNull Function1<@NonNull ApkSigningConfigUnit> action
)