I have an app with different layouts - for tablets, normal portrait and small. How can I write and execute different test suites for each device type ?
I have an app with different layouts - for tablets, normal portrait and small. How can I write and execute different test suites for each device type ?
Annotating your tests with conditions that must evaluate to true in order to run is one way to do it. The repository Android Test Rules helps you do it like this:
@Test
@IgnoreWhen(device = Form.Tablet.class)
public void phoneCanMakeACall() {
// Run test that only applies to phones.
}
Just follow the steps in the README. Those steps also show you how to create more conditions to add to the ones already provided.
Notes:
@IgnoreWhen annotation more than once for a test method is not possible, I haven't yet figured out how to combine my custom conditions with the ones already provided without copying and pasting their logic into my code.