AgpTestSuiteTarget

Added in 8.12.0-alpha09

@Incubating
interface AgpTestSuiteTarget : TestSuiteTarget, Named


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 properties

MutableList<String>

Defines which group of devices or devices to run the test suite tests against.

Public properties

targetDevices

Added in 8.12.0-alpha09
val targetDevicesMutableList<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.