# TestVariantBuilder

# TestVariantBuilder

```
interface TestVariantBuilder : VariantBuilder
```

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [com.android.build.api.variant.TestVariantBuilder](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/TestVariantBuilder#) |

[VariantBuilder](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder)type for tests associated with a module.

## Summary

| ### Inherited functions ||
|---|---|
| From class[VariantBuilder](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder) |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [registerExtension](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#registerExtension(java.lang.Class,%20com.android.build.api.variant.VariantBuilder.registerExtension.T))`(`type:` `[Class](http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html)<out` `T>`, `instance:` `T`)` <br /> Registers an extension object to the variant object. Extension objects can be looked up during the[com.android.build.api.extension.AndroidComponentsExtension.onVariants](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/extension/AndroidComponentsExtension.html#onVariants(com.android.build.api.extension.VariantSelector,%20kotlin.Function1))callbacks by using the[Variant.getExtension](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#getExtension(java.lang.Class))API. This is very useful for third party plugins that want to attach some variant specific configuration object to the Android Gradle Plugin variant object and make it available to other plugins. <br /> | ||

| ### Inherited properties ||
|---|---|
| From class[VariantBuilder](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder) |------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [enableUnitTest](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#enableUnitTest:kotlin.Boolean) <br /> Set to`true`if the variant's has any unit tests, false otherwise. Value is[Boolean#True](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/TestVariantBuilder#)by default. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)?        | [maxSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#maxSdk:kotlin.Int) <br /> Gets the maximum supported SDK Version for this variant. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)?        | [minSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdk:kotlin.Int) <br /> Gets or sets the minimum supported SDK Version for this variant. Setting this it will override previous calls of[minSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdk:kotlin.Int)and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdkPreview:kotlin.String)setters. Only one of[minSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdk:kotlin.Int)and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdkPreview:kotlin.String)should be set. <br />                                                           | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?  | [minSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdkPreview:kotlin.String) <br /> Gets or sets the minimum supported SDK Version for this variant as a Preview codename. Setting this it will override previous calls of[minSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdk:kotlin.Int)and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdkPreview:kotlin.String)setters. Only one of[minSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdk:kotlin.Int)and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#minSdkPreview:kotlin.String)should be set. <br />                    | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [renderscriptTargetApi](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#renderscriptTargetApi:kotlin.Int) <br /> Specifies the bytecode version to be generated. We recommend you set this value to the lowest API level able to provide all the functionality you are using <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)?        | [targetSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdk:kotlin.Int) <br /> Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of[targetSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdk:kotlin.Int)and[targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdkPreview:kotlin.String)setters. Only one of[targetSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdk:kotlin.Int)and[targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdkPreview:kotlin.String)should be set. <br />                  | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?  | [targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdkPreview:kotlin.String) <br /> Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of[targetSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdk:kotlin.Int)and[targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdkPreview:kotlin.String)setters. Only one of[targetSdk](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdk:kotlin.Int)and[targetSdkPreview](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#targetSdkPreview:kotlin.String)should be set. <br /> | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [unitTestEnabled](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#unitTestEnabled:kotlin.Boolean) <br /> Set to`true`if the variant's has any unit tests, false otherwise. Value is[Boolean#True](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/TestVariantBuilder#)by default. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | ||