SkipUnsupportedDeviceActionsRule


class SkipUnsupportedDeviceActionsRule : TestRule


Rule for skipping tests when a device action is called on an unsupported device.

DeviceActions throw UnsupportedDeviceOperationExceptions when actions cannot be performed on the test device. This rule catches those exceptions and skips the tests where they are thrown. Without this rule, tests will fail when a device action is performed on an unsupported device.

Example usage:

class SampleTest {
@get:Rule
val rule = SkipUnsupportedDeviceActionsRule()

@Test
fun testDeviceActions() {
onDevice().setFlatMode()
}
}

Summary

Public constructors

Public functions

open Statement
apply(statement: Statement, description: Description)

Public constructors

SkipUnsupportedDeviceActionsRule

SkipUnsupportedDeviceActionsRule()

Public functions

apply

open fun apply(statement: Statement, description: Description): Statement