# DeviceTestBuilder

# 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  

<br />

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

<br />

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

|--------------------------------------------------------------------------------------------------------------------------------------|---|
| [AndroidTestBuilder](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/AndroidTestBuilder) |   |

*** ** * ** ***

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

## Summary

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

|                               ### Public properties                                |
|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [enable](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/DeviceTestBuilder#enable()) Set to`true`if the variant's has any device tests, false otherwise.                                        |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [enableCodeCoverage](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/DeviceTestBuilder#enableCodeCoverage()) Specifies host test code coverage data collection by configuring the JacocoPlugin. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.android.build.api.variant.GeneratesApkBuilder](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/GeneratesApkBuilder) |---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)    | [debuggable](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/GeneratesApkBuilder#debuggable()) Sets the APK debuggable flag.                                                     | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`?` | [enableMultiDex](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/GeneratesApkBuilder#enableMultiDex()) Sets whether multi-dex is enabled for this variant.                       | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`?`         | [targetSdk](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/variant/GeneratesApkBuilder#targetSdk()) Sets the target SDK Version for this variant as an integer API level.               | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`   | [targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/8.11/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
```

Specifies host 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[com.android.build.api.dsl.BuildType.enableAndroidTestCoverage](https://developer.android.com/reference/tools/gradle-api/8.11/com/android/build/api/dsl/BuildType#enableAndroidTestCoverage()),