# TestOptions

# TestOptions

```
@Incubating interface TestOptions
```

|----------------------------------------------------------------------------------------------------------------------------------------------|
| [com.android.build.api.dsl.TestOptions](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#) |

Options for running tests.

## Summary

|                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                ||
|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [unitTests](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#unitTests(kotlin.Function1))`(`action:` `[UnitTestOptions](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/UnitTestOptions).()` `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Options for controlling unit tests execution. |

|                                                                                                                                                                               ### Properties                                                                                                                                                                               ||
|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                        | [animationsDisabled](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#animationsDisabled:kotlin.Boolean) Disables animations during instrumented tests you run from the command line. |
| abstract[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                          | [execution](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#execution:kotlin.String) Specifies whether to use on-device test orchestration.                                          |
| abstract[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?                                         | [reportDir](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#reportDir:kotlin.String) Name of the reports directory.                                                                  |
| abstract[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?                                         | [resultsDir](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#resultsDir:kotlin.String) Name of the results directory.                                                                |
| abstract[UnitTestOptions](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/UnitTestOptions) | [unitTests](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/TestOptions#unitTests:com.android.build.api.dsl.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](https://d.android.com/studio/test/command-line.html).  

### execution

Added in[API level 3.0.0](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract var execution: String
```

Specifies whether to use on-device test orchestration.

If you want to[use Android Test Orchestrator](https://developer.android.com/training/testing/junit-runner.html#using-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.  

```scdoc
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.