DeviceTestRunConfigureAction

@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
configureTaskInput(deviceDSL: DeviceT, project: Project)

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

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.