# DeviceTestRunConfigureAction

# DeviceTestRunConfigureAction

<br />

```
@Incubating interface DeviceTestRunConfigureAction<DeviceT : Device, InputT : DeviceTestRunInput>
```

<br />

*** ** * ** ***

Action for configuring the device specific[inputs](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)for the Managed Device Test Task.

This class is used to take the[managed device DSL](https://developer.android.com/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](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)

This should be implemented for use with a Custom Managed Device Registration.

Example[DeviceTestRunInput](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)and[Device](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Device)implementation for Configuration Action  

```scalate-server-page
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](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunConfigureAction)implementation  

```text
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](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Device)`>`                                                  | : The interface of the Custom Managed Device this configure action corresponds to.                                                                                                                                                               |
| `<InputT : `[DeviceTestRunInput](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)`>` | : The specialized[DeviceTestRunInput](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunInput)this configuration action generates for the instrumentation test task. |

## Summary

|                                                                                                                                                                                                                                                                            ### Public functions                                                                                                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html)` InputT` | [configureTaskInput](https://developer.android.com/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. |

## Public functions

### configureTaskInput

```
@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](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html) | 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](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/instrumentation/manageddevice/DeviceTestRunTaskAction). |