# AgpTestSuiteTarget

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


```
@Incubating
interface AgpTestSuiteTarget : TestSuiteTarget, Named
```

<br />

*** ** * ** ***

A test suite target is a collection of tests that run in a particular context. The context is defined by the devices they run on when dealing with a device test.

android { // ... other android configurations like compileSdk, defaultConfig, etc.

```
testOptions {
    managedDevices {
        localDevices {
            // First, define your individual managed devices
            create("pixel2api30") {
                device = "Pixel 2"
                apiLevel = 30
                systemImageSource = "aosp-atd" // or "google", "google-atd", "aosp"
            }
            create("pixel6api33") {
                device = "Pixel 6"
                apiLevel = 33
                systemImageSource = "google-atd"
            }
            create("largeScreenApi31") {
                device = "Nexus 10" // Example of a tablet
                apiLevel = 31
                systemImageSource = "aosp"
            }
        }
        groups {
            // Now, define your groups referencing the devices above
            create("phoneGroup") {
                // This group targets specific phone-like devices
                targetDevices.add(allDevices.getByName("pixel2api30"))
                targetDevices.add(allDevices.getByName("pixel6api33"))
                // You can also set properties for all devices in this group
                // if they are not already set on the individual device.
                // For example:
                // systemImageSource = "aosp-atd" // if all devices in this group should use this
            }
            create("tabletGroup") {
                // This group targets tablet-like devices
                targetDevices.add(devices.getByName("largeScreenApi31"))
            }
            create("allMyCiDevices") {
                // This group could target all devices you use for CI
                targetDevices.addAll(devices.getByName("pixel2api30"), devices.getByName("pixel6api33"), devices.getByName("largeScreenApi31"))
            }
        }
    }
}
testOptions {
    suites {
         create("someTestSuite") {
              targets {
                  create("tabletRun") {
                     targetDevices += "tabletGroup"
                  }
              }
         }
    }
}
```

}

## 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/AgpTestSuiteTarget#configureTestTasks(kotlin.Function2)(action: https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html.(context: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/TestTaskContext) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` Configure the test tasks for this test suite target. |

| ### Public properties |
|---|---|
| `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/AgpTestSuiteTarget#targetDevices()` Defines which group of devices or devices to run the test suite tests against. |

### 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` From [org.gradle.testing.base.TestSuiteTarget](https://docs.gradle.org/current/javadoc/org/gradle/testing/base/TestSuiteTarget.html) `https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html<https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html>` `https://docs.gradle.org/current/javadoc/org/gradle/testing/base/TestSuiteTarget.html#binaryResultsDirectory`

## Public functions

### configureTestTasks

Added in 9.6.0-alpha03

```
@Incubating
fun configureTestTasks(action: Test.(context: TestTaskContext) -> Unit): Unit
```

Configure the test tasks for this test suite target.

Even for a single target, `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuiteTarget#configureTestTasks(kotlin.Function2)` may run multiple times (for example per `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuite#targetVariants()` entry, per device-allocated `https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html` task, and for both test and update tasks when `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuite#requiresUpdateTask()` is enabled). Always inspect the `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/TestTaskContext` parameter rather than assuming a single task instance.

| Parameters |
|---|---|
| `action: https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html.(context: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/TestTaskContext) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | a block to configure the `https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html` tasks associated with this test suite target. |

| See also |
|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/AgpTestSuite#configureTestTasks(kotlin.Function2)` |   |

## Public properties

### targetDevices

Added in 8.12.0

```
val targetDevices: MutableList<String>
```

Defines which group of devices or devices to run the test suite tests against. If the test runs on the host machine, this list will be ignored.