# HostTest

# HostTest

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

<br />

```
interface HostTest : TestComponent
```

<br />

*** ** * ** ***

Model for Host Test components that contains build-time properties. Host Tests run on a JVM on your build machine, as opposed to[DeviceTest](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/DeviceTest)which run on an Android Device.

This object is accessible on subtypes of[Variant](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Variant)that implement[HasHostTests](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HasHostTests), via[HasHostTests.hostTests](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HasHostTests#hostTests()). It is also part of[Variant.nestedComponents](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Variant#nestedComponents()).

The presence of this component in a variant is controlled by[HostTestBuilder.enable](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HostTestBuilder#enable())which is accessible on subtypes of[VariantBuilder](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/VariantBuilder)that implement[HasHostTestsBuilder](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HasHostTestsBuilder)

## Summary

|                             ### Public functions                             |
|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [configureTestTask](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HostTest#configureTestTask(kotlin.Function1))`(action: (`[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)`) `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Runs some action to configure the Variant's unit test[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)task. |

|                               ### Public properties                                |
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [codeCoverageEnabled](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HostTest#codeCoverageEnabled()) Whether test coverage is enabled for this host test. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.android.build.api.variant.Component](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component) |------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [computeTaskName](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#computeTaskName(kotlin.String,kotlin.String))`(action: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, subject: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Utility method to create unique task name for component.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html) | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [getResolvableConfiguration](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#getResolvableConfiguration(kotlin.String))`(sourceSetConfigurationsAffix: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Access to the component's resolvable configuration corresponding to the source set configurations added via[AndroidComponentsExtension.addSourceSetConfigurations](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/AndroidComponentsExtension#addSourceSetConfigurations(kotlin.String)).                                                                                                                                                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                         | ~~[setAsmFramesComputationMode](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#setAsmFramesComputationMode(com.android.build.api.instrumentation.FramesComputationMode))~~`(mode: `[FramesComputationMode](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/instrumentation/FramesComputationMode)`)` **This function is deprecated.**Will be removed in v9.0, use the instrumentation block.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                         | `<ParamT : `[InstrumentationParameters](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/instrumentation/InstrumentationParameters)`> `~~[transformClassesWith](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#transformClassesWith(java.lang.Class,com.android.build.api.instrumentation.InstrumentationScope,kotlin.Function1))~~`(` ` classVisitorFactoryImplClass: `[Class](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html)`<`[AsmClassVisitorFactory](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/instrumentation/AsmClassVisitorFactory)`<ParamT>>,` ` scope: `[InstrumentationScope](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/instrumentation/InstrumentationScope)`,` ` instrumentationParamsConfig: (ParamT) `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) `)` **This function is deprecated.**Will be removed in v9.0, use the instrumentation block. | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.android.build.api.variant.Component](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component) |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)                                                                            | [annotationProcessorConfiguration](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#annotationProcessorConfiguration()) Access to the variant's annotation processor[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html); for example, the debugAnnotationProcessor[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)for the debug variant. | | [Artifacts](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/artifact/Artifacts)                                                             | [artifacts](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#artifacts()) Access to the variant's buildable artifacts for build customization.                                                                                                                                                                                                                                                                                                | | [FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html)                                                                               | [compileClasspath](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#compileClasspath()) Access to the variant's compile classpath.                                                                                                                                                                                                                                                                                                            | | [Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)                                                                            | [compileConfiguration](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#compileConfiguration()) Access to the variant's compile[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html); for example, the debugCompileClasspath[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)for the debug variant.                                         | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                              | [debuggable](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#debuggable()) Whether the produced artifacts will be debuggable                                                                                                                                                                                                                                                                                                                 | | [Instrumentation](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Instrumentation)                                                  | [instrumentation](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#instrumentation()) Access to the variant's instrumentation options.                                                                                                                                                                                                                                                                                                        | | [JavaCompilation](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/JavaCompilation)                                                  | [javaCompilation](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#javaCompilation()) Access to the variant's java compilation options.                                                                                                                                                                                                                                                                                                       | | [LifecycleTasks](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/LifecycleTasks)                                                    | [lifecycleTasks](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#lifecycleTasks()) Provides access to the[LifecycleTasks](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/LifecycleTasks)created for this component.                                                                                                                                                                             | | [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`>` | [namespace](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#namespace()) The namespace of the generated R and BuildConfig classes.                                                                                                                                                                                                                                                                                                           | | [Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)                                                                            | [runtimeConfiguration](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#runtimeConfiguration()) Access to the variant's runtime[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html); for example, the debugRuntimeClasspath[Configuration](https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html)for the debug variant.                                         | | [Sources](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Sources)                                                                  | [sources](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/Component#sources()) Access to variant's source files.                                                                                                                                                                                                                                                                                                                                       | |
| From[com.android.build.api.variant.ComponentIdentity](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/ComponentIdentity) |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                                                                                                | [buildType](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/ComponentIdentity#buildType()) Build type name.                        | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                                                                                                | [flavorName](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/ComponentIdentity#flavorName()) The multi-flavor name of the variant. | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                                                                                                                                                                                                   | [name](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/ComponentIdentity#name()) Component's name.                                 | | [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`>>` | [productFlavors](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/ComponentIdentity#productFlavors()) List of flavor names.         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| From[com.android.build.api.variant.TestComponent](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/TestComponent) |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`>` | [manifestPlaceholders](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/TestComponent#manifestPlaceholders()) [MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)of the test component's manifest placeholders. |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Public functions

### configureTestTask

Added in 8.5.0  

```
fun configureTestTask(action: (Test) -> Unit): Unit
```

Runs some action to configure the Variant's unit test[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)task.

The action will only run if the task is configured. In particular the \[HasHostTestsBuilder.hostTestsHasHostTestsBuilder.UNIT_TEST_TYPE?.enable\] must be set to true (it is true by default).

Example :  

```gdscript
androidComponents {
    onVariants { variant ->
        variant.hostTests[HostTestsBuilder.UNIT_TEST_TYPE]?.configureTestTask { testTask ->
            testTask.beforeTest { descriptor ->
                println("Running test: " + descriptor)
            }
        }
    }
}
```  

|                                                                                       Parameters                                                                                       |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| `action: (`[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)`) `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | to configure the[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)task. |

## Public properties

### codeCoverageEnabled

Added in 8.5.0  

```
val codeCoverageEnabled: Boolean
```

Whether test coverage is enabled for this host test.

If enabled, this uses Jacoco to capture coverage and creates a report in the build directory.

You cannot change the value any longer, to change it, please use[HostTestBuilder.enableCodeCoverage](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/HostTestBuilder#enableCodeCoverage())in the[AndroidComponentsExtension.beforeVariants](https://developer.android.com/reference/tools/gradle-api/8.10/com/android/build/api/variant/AndroidComponentsExtension#beforeVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1))callback.