Inter-app UI testing with UIAutomator
suggest changeSyntax
- Instrumentation InstrumentationRegistry.getInstrumentation()
- UiDevice UiDevice.getInstance(Instrumentation instrumentation)
- boolean UiDevice.pressHome()
- boolean UiDevice.pressBack()
- boolean UiDevice.pressRecentApps()
- void UiDevice.wakeUp()
- boolean UiDevice.swipe(int startX, int startY, int endX, int endY, int steps)
- boolean UiDevice.drag(int startX, int startY, int endX, int endY, int steps)
- UiObject2 UiDevice.findObject(By.desc(String contentDesc))
- boolean UiObject2.click()
Remarks
UIAutomator is especially good for testing user stories. You run into problems if view elements have neither a unique resource-id nor content-desc. In most of the cases there is a way to complete the test anyway, though that takes a lot of time. If you can influence the code of your app, UIAutomator may be your testing tool.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents