# TestSuiteBuilder

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


```
interface TestSuiteBuilder : Named
```

<br />

*** ** * ** ***

Interface to configure `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestSuite` during the `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#beforeVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1)` callbacks.

## Usage example

```
androidComponents.beforeVariants { variant ->
    (variant as? HasTestSuites)?.suites.forEach { suiteBuilder ->
         suiteBuilder.enable = false
    }
}
```

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/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/TestSuiteBuilder#setEnabledCodeCoverage(kotlin.Boolean)(value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Specifies test suite code coverage data collection by configuring the JacocoPlugin. |

| ### 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/TestSuiteBuilder#enable()` Enables or disable the test suite for the current variant. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/JUnitEngineSpecBuilder` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestSuiteBuilder#junitEngineSpec()` Configure the `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/JUnitEngineSpec` for this test suite in this variant. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<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/TestSuiteTargetBuilder>` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestSuiteBuilder#targets()` Configure the list of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestSuiteTargetBuilder` for this test suite in this variant. |

### Inherited properties

From [org.gradle.api.Named](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#name`

## Public functions

### setEnabledCodeCoverage

Added in 9.6.0-alpha03

```
@Incubating
fun setEnabledCodeCoverage(value: Boolean): Unit
```

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

When enabled, the Jacoco plugin is applied and coverage data is collected by the Jacoco plugin.

If the value is initialized from the DSL `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuite#codeCoverage()`, it will be used.

## Public properties

### enable

Added in 9.6.0-alpha03

```
var enable: Boolean
```

Enables or disable the test suite for the current variant.

### junitEngineSpec

Added in 9.6.0-alpha03

```
val junitEngineSpec: JUnitEngineSpecBuilder
```

Configure the `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/JUnitEngineSpec` for this test suite in this variant.

### targets

Added in 9.6.0-alpha03

```
val targets: Map<String, TestSuiteTargetBuilder>
```

Configure the list of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestSuiteTargetBuilder` for this test suite in this variant.

The `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html` keys are the test suite names.