Stay organized with collections
Save and categorize content based on your preferences.
@Incubating interface DeviceTestRunConfigureAction<DeviceT : Device, InputT : DeviceTestRunInput>
Action for configuring the device specific inputs
for the Managed Device Test Task.
This class is used to take the managed device DSL
and other Project
settings to create a group of cachable inputs
This should be implemented for use with a Custom Managed Device Registration.
Example DeviceTestRunInput
and Device
implementation for Configuration Action
abstract class CustomInput: DeviceTestRunInput {
/** name of device from DSL */
@get: Input
abstract val deviceName: Property<String>
/** Id of device in a device farm, for example*/
@get: Input
abstract val deviceId: Property<Int>
@get: Internal
abstract val timeoutSeconds: Property<Int>
}
open class CustomDevice @Inject constructor(private val name: String): Device {
override fun getName() = name
var id: Int = 0
var timeoutSeconds: Int = 30
}
DeviceTestRunConfigureAction
implementation
CustomConfigureAction(): DeviceTestRunConfigureAction<CustomDevice, CustomInput> {
override fun configureTaskInput(
deviceDSL: CustomDevice, project: Project): CustomInput =
project.objects.newInstance(CustomInput::class.java).apply {
deviceName.set(deviceDSL.getName())
deviceId.set(deviceDSL.id)
timeoutSectonds.set(deviceDSL.timeoutSeconds)
}
}
Parameters |
<DeviceT : Device> |
: The interface of the Custom Managed Device this configure action corresponds to.
|
<InputT : DeviceTestRunInput> |
: The specialized DeviceTestRunInput this configuration action generates for the instrumentation test task.
|
Summary
Public functions |
@Incubating InputT |
Generates the cacheable inputs to the test run task to be consumed by the corresponding test run action.
|
Public functions
@Incubating
fun configureTaskInput(deviceDSL: DeviceT, project: Project): InputT
Generates the cacheable inputs to the test run task to be consumed by the corresponding test run action.
Parameters |
deviceDSL: DeviceT |
The DSL for the individual device for the test task.
|
project: Project |
The Project that this test task is being created for.
|
Returns |
InputT |
The cacheable inputs for the test task. This will be consumed as part of the test run action .
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# DeviceTestRunConfigureAction\n============================\n\n\n```\n@Incubating interface DeviceTestRunConfigureAction\u003cDeviceT : Device, InputT : DeviceTestRunInput\u003e\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAction for configuring the device specific [inputs](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput) for the Managed Device Test Task.\n\nThis class is used to take the [managed device DSL](/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Device) and other [Project](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html) settings to create a group of [cachable inputs](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)\n\nThis should be implemented for use with a Custom Managed Device Registration.\n\nExample [DeviceTestRunInput](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput) and [Device](/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Device) implementation for Configuration Action \n\n```scalate-server-page\nabstract class CustomInput: DeviceTestRunInput {\n /** name of device from DSL */\n @get: Input\n abstract val deviceName: Property\u003cString\u003e\n\n /** Id of device in a device farm, for example*/\n @get: Input\n abstract val deviceId: Property\u003cInt\u003e\n\n @get: Internal\n abstract val timeoutSeconds: Property\u003cInt\u003e\n }\n\n open class CustomDevice @Inject constructor(private val name: String): Device {\n\n override fun getName() = name\n\n var id: Int = 0\n\n var timeoutSeconds: Int = 30\n }\n```\n\n[DeviceTestRunConfigureAction](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunConfigureAction) implementation \n\n```text\nCustomConfigureAction(): DeviceTestRunConfigureAction\u003cCustomDevice, CustomInput\u003e {\n\n override fun configureTaskInput(\n deviceDSL: CustomDevice, project: Project): CustomInput =\n project.objects.newInstance(CustomInput::class.java).apply {\n deviceName.set(deviceDSL.getName())\n deviceId.set(deviceDSL.id)\n timeoutSectonds.set(deviceDSL.timeoutSeconds)\n }\n}\n``` \n\n| Parameters ||\n|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `\u003cDeviceT : `[Device](/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Device)`\u003e` | : The interface of the Custom Managed Device this configure action corresponds to. |\n| `\u003cInputT : `[DeviceTestRunInput](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)`\u003e` | : The specialized [DeviceTestRunInput](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput) this configuration action generates for the instrumentation test task. |\n\nSummary\n-------\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html)` InputT` | [configureTaskInput](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunConfigureAction#configureTaskInput(com.android.build.api.dsl.Device,org.gradle.api.Project))`(deviceDSL: DeviceT, project: `[Project](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html)`)` Generates the cacheable inputs to the test run task to be consumed by the corresponding test run action. |\n\nPublic functions\n----------------\n\n### configureTaskInput\n\n```\n@Incubating\nfun configureTaskInput(deviceDSL: DeviceT, project: Project): InputT\n```\n\nGenerates the cacheable inputs to the test run task to be consumed by the corresponding test run action. \n\n| Parameters ||\n|-------------------------------------------------------------------------------------------|-------------------------------------------------------|\n| `deviceDSL: DeviceT` | The DSL for the individual device for the test task. |\n| `project: `[Project](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html) | The Project that this test task is being created for. |\n\n| Returns ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `InputT` | The cacheable inputs for the test task. This will be consumed as part of the [test run action](/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunTaskAction). |"]]