# DeviceTestBuilder

[View Source](https://cs.android.com/search?q=file:com/android/build/api/variant/DeviceTestBuilder.kt+class:com.android.build.api.variant.DeviceTestBuilder) Added in 8.4.0


```
@Incubating
interface DeviceTestBuilder : GeneratesTestApkBuilder
```

<br />

Known direct subclasses [AndroidTestBuilder](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidTestBuilder)

|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidTestBuilder` |   |

*** ** * ** ***

Interface to turn tests on devices, `AndroidTest` being an example of device tests.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `@https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DeviceTestBuilder#ANDROID_TEST_TYPE()` Host test type for default unit tests. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DeviceTestBuilder#enable()` Set to `true` if the variant's has any device tests, false otherwise. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DeviceTestBuilder#enableCodeCoverage()` **The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage, use \[DeviceTest.codeCoverageEnabled\] |

### Inherited properties

From [com.android.build.api.variant.GeneratesApkBuilder](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder#debuggable()`

**The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html?` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder#enableMultiDex()`

**The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html?` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder#targetSdk()`

Sets the target SDK Version for this variant as an integer API level.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder#targetSdkPreview()`

Sets the target SDK Version for this variant as an integer API level.

## Constants

### ANDROID_TEST_TYPE

Added in 8.7.0

```
@Incubating
const val ANDROID_TEST_TYPE: String
```

Host test type for default unit tests.

## Public properties

### enable

Added in 8.4.0

```
var enable: Boolean
```

Set to `true` if the variant's has any device tests, false otherwise. Value is Boolean#True by default.

### enableCodeCoverage

Added in 8.5.0 Deprecated in 8.5.0

```
var enableCodeCoverage: Boolean
```

> [!CAUTION]
> **The getter for this property is deprecated.**   
> Other plugins can change this value, it is not safe to read it at this stage, use \[DeviceTest.codeCoverageEnabled\]

Specifies device test code coverage data collection by configuring the JacocoPlugin.

When enabled, the Jacoco plugin is applied and coverage data is collected by the Jacoco plugin. This can avoid unwanted build time instrumentation required to collect coverage data from other test types such as unit tests.

If the value is initialized from the DSL `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildType#enableAndroidTestCoverage()`,