# ScreenshotTestSuite

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


```
@Incubating
interface ScreenshotTestSuite
```

<br />

*** ** * ** ***

A test suite to run Compose screenshot tests.

A `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ScreenshotTestSuite` configures the execution environment and inputs required to render Compose previews and execute screenshot tests.

Example usage:

```
android {
    testOptions {
        screenshotTests {
            create("myScreenshotTest") {
                engineVersion = "1.0.0"
                imageDifferenceThreshold = 0.0001f
                targetVariants.add("debug")
                dependencies {
                    implementation(project(":my-test-helpers"))
                }
            }
        }
    }
}
```

## 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/dsl/ScreenshotTestSuite#dependencies(kotlin.Function1)(action: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuiteDependencies.() -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` Configures the dependencies for this test suite. |

| ### Public properties |
|---|---|
| `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/dsl/ScreenshotTestSuite#engineVersion()` The version of the screenshot validation engine. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ScreenshotTestSuite#imageDifferenceThreshold()` The maximum allowed percentage difference between the reference image and the rendered image for a screenshot test to pass. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/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/dsl/ScreenshotTestSuite#targetVariants()` Defines which variants this test suite targets. |

## Public functions

### dependencies

Added in 9.6.0-alpha03

```
@Incubating
fun dependencies(action: AgpTestSuiteDependencies.() -> Unit): Unit
```

Configures the dependencies for this test suite.

Dependencies are added to the test suite's host (JVM) execution classpath. This enables the screenshot tests to access custom test helpers and preview providers during rendering.

## Public properties

### engineVersion

Added in 9.6.0-alpha03

```
var engineVersion: String?
```

The version of the screenshot validation engine.

Specifies the version of the `com.android.tools.screenshot:screenshot-validation-junit-engine` artifact (published on the Google Maven repository) to use for layout rendering and screenshot validation.

This property is mandatory. A valid version must be provided; otherwise, a Gradle sync error will be reported.

### imageDifferenceThreshold

Added in 9.6.0-alpha03

```
var imageDifferenceThreshold: Float?
```

The maximum allowed percentage difference between the reference image and the rendered image for a screenshot test to pass.

Specified as a floating-point value between `0.0f` (exact match required) and `1.0f` (100% difference allowed). For example, a value of `0.0001f` represents a 0.01% difference threshold.

If `null`, the default engine threshold (0.0f) will be used.

### targetVariants

Added in 9.6.0-alpha03

```
val targetVariants: MutableList<String>
```

Defines which variants this test suite targets.