Moreover, these tests inherit the following checks:
The default tests can be disabled by overriding the respective methods and including an @Ignore
annotation.
NonRotationTestBase
was created to make it easier to write tests that do not involve rotation (e.g., Pip
, split screen
or IME
). Tests that inherit from the class are automatically executed twice: once in portrait and once in landscape mode and the assertions are checked independently. Moreover, these tests inherit the following checks:
The default tests can be disabled by overriding the respective methods and including an @Ignore
annotation.
Tests that rotate the device should inherit from RotationTestBase
. This class allows the test to be freely configured and does not provide any assertions.
Start by defining common or error prone transitions using TransitionRunner
.
@LargeTest @RunWith(Parameterized::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class MyTest( beginRotationName: String, beginRotation: Int ) : NonRotationTestBase(beginRotationName, beginRotation) { init { mTestApp = MyAppHelper(InstrumentationRegistry.getInstrumentation()) } override val transitionToRun: TransitionRunner get() = TransitionRunner.newBuilder() .withTag("myTest") .recordAllRuns() .runBefore { device.pressHome() } .runBefore { device.waitForIdle() } .run { testApp.open() } .runAfter{ testApp.exit() } .repeat(2) .includeJankyRuns() .build() @Test fun myWMTest() { checkResults { WmTraceSubject.assertThat(it) .showsAppWindow(MyTestApp) .forAllEntries() } } @Test fun mySFTest() { checkResults { LayersTraceSubject.assertThat(it) .showsLayer(MyTestApp) .forAllEntries() } } }