Inter-app UI testing with UIAutomator

Download android eBook


  • Instrumentation 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


UIAutomator are 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 anyways, what that takes a lot of time. If you can influence the code of your app, UIAutomator may be your testing tool.

Related Examples


31 Contributors: 1
Monday, September 12, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial:

Download eBook