1 https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html http://www.cnblogs.com/ By-dream/p/4921701.html http://blog.csdn.net/maocaowu_csdn/article/details/50684309
2 The process of using uiautomator
(1) Obtain an UiDevice
object that represents the device on which we are executing the test .
(2)通过findObject()
方法获取到一个UiObject
对象,代表我们需要执行测试的UI组件
(3)
perform a series of actions on the UI component.
(4) Check whether the results of the operation are in line with expectations.
3 Uidevice API
(1) getinstance (), getInstance()
obtained by method to the current device, into an Instrumentation
object:
UiDevice mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
(2) Other common interfaces
Start from the home screen
Mdevice.presshome ();
(3) Getlauncherpackagename
Wati for launch
Mdevice.getlauncherpackagename (); For a description of the Java final keyword, see http://www.cnblogs.com/lwbqqyumidi/p/3513047.html
Mdevice.wait (Until. Hasobject (by. Pkg (launcherpackage). Depth (0)),
Launch_timeout);
(4)
Uiautomator Uideviceapi Introduction