# HostTestBuilder

# HostTestBuilder

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

<br />

```
@Incubating
interface HostTestBuilder
```

<br />

*** ** * ** ***

Interface to turn on or off host tests. Host tests run on the development machine,[UNIT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#UNIT_TEST_TYPE())or[SCREENSHOT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#SCREENSHOT_TEST_TYPE())are examples of host 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) [SCREENSHOT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#SCREENSHOT_TEST_TYPE()) Host test type for default screenshot tests. |
| `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) [UNIT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#UNIT_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.9/com/android/build/api/variant/HostTestBuilder#enable()) Set to`true`if the variant's has any host 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.9/com/android/build/api/variant/HostTestBuilder#enableCodeCoverage()) Specifies host test code coverage data collection by configuring the JacocoPlugin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)   | [type](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder#type()) Type of the[HostTest](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTest), which can be '[UNIT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#UNIT_TEST_TYPE())or[SCREENSHOT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#SCREENSHOT_TEST_TYPE())for[HostTest](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTest)s created by AGP. |

## Constants

### SCREENSHOT_TEST_TYPE

Added in 8.9.3  

```
@Incubating
const val SCREENSHOT_TEST_TYPE: String
```

Host test type for default screenshot tests.  

### UNIT_TEST_TYPE

Added in 8.9.3  

```
@Incubating
const val UNIT_TEST_TYPE: String
```

Host test type for default unit tests.  

## Public properties

### enable

Added in 8.9.3  

```
var enable: Boolean
```

Set to`true`if the variant's has any host tests, false otherwise.

Not setting this value relies on the AGP default behavior for this host test type.  

### enableCodeCoverage

Added in 8.9.3  
Deprecated in 8.9.3  

```
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 connected tests.

If the value is initialized from the DSL[com.android.build.api.dsl.BuildType.enableUnitTestCoverage](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/dsl/BuildType#enableUnitTestCoverage()), it will be used for HasHostTestsBuilder.UNIT_TEST_TYPE.  

### type

Added in 8.9.3  

```
var type: String
```

Type of the[HostTest](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTest), which can be '[UNIT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#UNIT_TEST_TYPE())or[SCREENSHOT_TEST_TYPE](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTestBuilder.Companion#SCREENSHOT_TEST_TYPE())for[HostTest](https://developer.android.com/reference/tools/gradle-api/8.9/com/android/build/api/variant/HostTest)s created by AGP.

For new instances, set the type to something meaningful for users.