SkipUnsupportedDeviceActionsRule


public final class SkipUnsupportedDeviceActionsRule implements 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 methods

@NonNull Statement
apply(@NonNull Statement statement, @NonNull Description description)

Public constructors

SkipUnsupportedDeviceActionsRule

public SkipUnsupportedDeviceActionsRule()

Public methods

apply

public @NonNull Statement apply(@NonNull Statement statement, @NonNull Description description)