# TestAndroidComponentsExtension

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


```
interface TestAndroidComponentsExtension : AndroidComponentsExtension<TestExtension, TestVariantBuilder, TestVariant>
```

<br />

*** ** * ** ***

Extension for the Android Test Gradle Plugin components.

This is the `androidComponents` block when the `com.android.test` plugin is applied.

Only the Android Gradle Plugin should create instances of interfaces in com.android.build.api.variant.

## Summary

### Inherited functions

From [com.android.build.api.variant.AndroidComponentsExtension](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension) `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/AndroidComponentsExtension#addSourceSetConfigurations(kotlin.String)(suffix: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Adds a custom configuration for each source set.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#beforeVariants(com.android.build.api.variant.VariantSelector,org.gradle.api.Action)(
selector: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector,
callback: https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html<https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestVariantBuilder>
)`

`https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html` based version of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#beforeVariants(com.android.build.api.variant.VariantSelector,org.gradle.api.Action)` above.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `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)(
selector: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector,
callback: (https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestVariantBuilder) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html
)`

Method to register a `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)` to be called with `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension` instances that satisfies 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)`.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,org.gradle.api.Action)(selector: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector, callback: https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html<https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestVariant>)`

`https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html` based version of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,org.gradle.api.Action)` above.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1)(selector: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector, callback: (https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestVariant) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`

Allow for registration of a `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1)` to be called with variant instances of type `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension` once the list of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact` has been determined.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#registerExtension(com.android.build.api.variant.DslExtension,kotlin.Function1)(
dslExtension: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DslExtension,
configurator: (variantExtensionConfig: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantExtensionConfig<https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/TestVariant>) -> https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantExtension
)`

Register an Android Gradle Plugin DSL extension.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#registerSourceType(kotlin.String)(name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Register a new source type to all source sets.
`https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#selector()()`

Creates a `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/VariantSelector` instance that can be configured to reduce the set of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/ComponentBuilder` instances participating in 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)` and `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1)` callback invocation.
From [com.android.build.api.variant.DslLifecycle](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DslLifecycle) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DslLifecycle#finalizeDsl(org.gradle.api.Action)(callback: https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html<https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/TestExtension>)`

`https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html` based version of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DslLifecycle#finalizeDsl(org.gradle.api.Action)` above.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DslLifecycle#finalizeDsl(kotlin.Function1)(callback: (https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/TestExtension) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`

API to customize the DSL Objects programmatically after they have been evaluated from the build files and before used in the build process next steps like variant or tasks creation.

### Inherited properties

From [com.android.build.api.variant.AndroidComponents](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponents) `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/AndroidPluginVersion` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponents#pluginVersion()`

The version of the Android Gradle Plugin currently in use.
`https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/SdkComponents` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponents#sdkComponents()`

Provides access to underlying Android SDK and build-tools components like adb.