# KotlinMultiplatformAndroidTestOnJvm

# KotlinMultiplatformAndroidTestOnJvm

<br />

```
@Incubating
public interface KotlinMultiplatformAndroidTestOnJvm
```

<br />

Known direct subclasses  
[KotlinMultiplatformAndroidTestOnJvmCompilation](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvmCompilation)  

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [KotlinMultiplatformAndroidTestOnJvmCompilation](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvmCompilation) |   |

*** ** * ** ***

## Summary

| ### Public methods |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract void`    | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [all](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#all(kotlin.Function1))`(@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` Function1<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[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)`> configAction)` Configures all unit testing tasks. |
| `abstract boolean` | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [getEnableCoverage](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#getEnableCoverage())`()` Specifies unit test code coverage data collection by configuring the JacocoPlugin.                                                                                                                                                                                                                                                                                                                                                             |
| `abstract boolean` | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [isIncludeAndroidResources](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#getIsIncludeAndroidResources())`()` Enables unit tests to use Android resources, assets, and manifests.                                                                                                                                                                                                                                                                                                                                                         |
| `abstract boolean` | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [isReturnDefaultValues](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#getIsReturnDefaultValues())`()` Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).                                                                                                                                                                                                                                                                                                                     |
| `abstract void`    | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [setEnableCoverage](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#setEnableCoverage(kotlin.Boolean))`(boolean enableCoverage)` Specifies unit test code coverage data collection by configuring the JacocoPlugin.                                                                                                                                                                                                                                                                                                                         |
| `abstract void`    | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [setIncludeAndroidResources](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#setIsIncludeAndroidResources(kotlin.Boolean))`(boolean isIncludeAndroidResources)` Enables unit tests to use Android resources, assets, and manifests.                                                                                                                                                                                                                                                                                                         |
| `abstract void`    | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [setReturnDefaultValues](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm#setIsReturnDefaultValues(kotlin.Boolean))`(boolean isReturnDefaultValues)` Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).                                                                                                                                                                                                                                                                         |

## Public methods

### all

```
@Incubating
abstract void all(@NonNull Function1<@NonNull Test, Unit> configAction)
```

Configures all unit testing tasks. See[Test](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)for available options. Inside the closure you can check the name of the task to configure only some test tasks  

### getEnableCoverage

```
@Incubating
abstract boolean getEnableCoverage()
```

Specifies unit 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.  

### isIncludeAndroidResources

```
@Incubating
abstract boolean isIncludeAndroidResources()
```

Enables unit tests to use Android resources, assets, and manifests.

If you set this property to`true`, the plugin performs resource, asset, and manifest merging before running your unit tests. Your tests can then inspect a file called`com/android/tools/test_config.properties`on the classpath, which is a Java properties file with the following keys:

`android_resource_apk`: the path to the APK-like zip file containing merged resources, which includes all the resources from the current subproject and all its dependencies. This property is available by default, or if the Gradle property`android.enableUnitTestBinaryResources`is set to`true`.

`android_merged_resources`: the path to the directory containing merged resources, which includes all the resources from the current subproject and all its dependencies. This property is available only if the Gradle property`android.enableUnitTestBinaryResources`is set to`false`.

`android_merged_assets`: the path to the directory containing merged assets. For app subprojects, the merged assets directory contains assets from the current subproject and its dependencies. For library subprojects, the merged assets directory contains only assets from the current subproject.

`android_merged_manifest`: the path to the merged manifest file. Only app subprojects have the manifest merged from their dependencies. Library subprojects do not include manifest components from their dependencies.

`android_custom_package`: the package name of the final R class. If you modify the application ID in your build scripts, this package name may not match the`package`attribute in the final app manifest.

Note that starting with version 3.5.0, if the Gradle property`android.testConfig.useRelativePath`is set to`true`, the paths above will be relative paths (relative to the current project directory, not the root project directory); otherwise, they will be absolute paths. Prior to version 3.5.0, the paths are all absolute paths.  

### isReturnDefaultValues

```
@Incubating
abstract boolean isReturnDefaultValues()
```

Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).

See[Test Your App](https://developer.android.com/studio/test/index.html)for details.  

### setEnableCoverage

```
@Incubating
abstract void setEnableCoverage(boolean enableCoverage)
```

Specifies unit 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.  

### setIncludeAndroidResources

```
@Incubating
abstract void setIncludeAndroidResources(boolean isIncludeAndroidResources)
```

Enables unit tests to use Android resources, assets, and manifests.

If you set this property to`true`, the plugin performs resource, asset, and manifest merging before running your unit tests. Your tests can then inspect a file called`com/android/tools/test_config.properties`on the classpath, which is a Java properties file with the following keys:

`android_resource_apk`: the path to the APK-like zip file containing merged resources, which includes all the resources from the current subproject and all its dependencies. This property is available by default, or if the Gradle property`android.enableUnitTestBinaryResources`is set to`true`.

`android_merged_resources`: the path to the directory containing merged resources, which includes all the resources from the current subproject and all its dependencies. This property is available only if the Gradle property`android.enableUnitTestBinaryResources`is set to`false`.

`android_merged_assets`: the path to the directory containing merged assets. For app subprojects, the merged assets directory contains assets from the current subproject and its dependencies. For library subprojects, the merged assets directory contains only assets from the current subproject.

`android_merged_manifest`: the path to the merged manifest file. Only app subprojects have the manifest merged from their dependencies. Library subprojects do not include manifest components from their dependencies.

`android_custom_package`: the package name of the final R class. If you modify the application ID in your build scripts, this package name may not match the`package`attribute in the final app manifest.

Note that starting with version 3.5.0, if the Gradle property`android.testConfig.useRelativePath`is set to`true`, the paths above will be relative paths (relative to the current project directory, not the root project directory); otherwise, they will be absolute paths. Prior to version 3.5.0, the paths are all absolute paths.  

### setReturnDefaultValues

```
@Incubating
abstract void setReturnDefaultValues(boolean isReturnDefaultValues)
```

Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).

See[Test Your App](https://developer.android.com/studio/test/index.html)for details.