TestOptions

@Incubating interface TestOptions
com.android.build.api.dsl.TestOptions

Options for running tests.

Summary

Public methods

abstract Unit
unitTests(action: UnitTestOptions.() -> Unit)

Options for controlling unit tests execution.

Properties

abstract Boolean

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

abstract String

Specifies whether to use on-device test orchestration.

abstract String?

Name of the reports directory.

abstract String?

Name of the results directory.

abstract UnitTestOptions

Options for controlling unit tests execution.

Public methods

unitTests

abstract fun unitTests(action: UnitTestOptions.() -> Unit): Unit

Options for controlling unit tests execution.

Properties

animationsDisabled

abstract 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.

execution

abstract 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.

android {
  testOptions {
    execution 'ANDROID_TEST_ORCHESTRATOR'
  }
}

reportDir

abstract var reportDir: String?

Name of the reports directory.

resultsDir

abstract var resultsDir: String?

Name of the results directory.

unitTests

abstract val unitTests: UnitTestOptions

Options for controlling unit tests execution.