Comparison of automated testing frameworks (UIAutomator, Appium, Robotium)

Reprinted from: http://www.cnblogs.com/liuyuxuan/p/5614923.html

 

 

 

 

 

Comparison of automated testing frameworks (UIAutomator, Appium, Robotium)

 

 

 

1. Principle

1.UiAutomator - UIAutomation-based UI automation testing framework, which can work across applications, Google's own.

UIAutomation has a new version when Android 4.3 is released, the official introduction: http://blog.csdn.net/zhubaitian/article/details/40504827 .

Before Android 4.3: use inputManager or earlier WindowsManager to inject KeyEvent

After Android 4.3: Use Accessibility APIs to inject events. (AccessibilityService was originally intended to do some auxiliary functions, providing a series of event callbacks to help us indicate some user and interface state changes, mainly to help people with disabilities.)

2. Robotium - a test framework developed based on Instrumentation

Official introduction of Instrumentation: http://blog.csdn.net/zhubaitian/article/details/39578915

Instrumentation can load the test package and the target test application into the same process. Now that each control and the test code are running in the same process, the test code can of course call the methods of these controls, and modify and verify some items of these controls at the same time.

The operating principle of Instrumentation: InstrumentationTestRunner will call the onCreate method to create a new thread and add a message queue to this thread before the target application code runs. This thread processes and interacts with message events sent by other threads in a loop.

Cross-application: After Android 4.3, Instrumentation introduced an instance of the getUiAutomation interface for cross-application testing.

3. Appium - cross-platform, allows to use the same set of APIs to write test code on different platforms (IOS, Android), making it possible for the test suite to realize code reuse on the IOS and Android platforms.

At its core, Appium is a web server that exposes a REST API. This server receives connections from clients, listens for commands from clients, runs the commands on the mobile device, and sends back to the client an HTTP response packet representing the result of the command.

 

2. Comparison of advantages and disadvantages

 
UiAutomator
Robotium
Appium
Whether it supports device source-free testing (black box testing) Whether it is possible to perform cross-application testing whether it is natively supported by Google whether the programming language has the same signature problem Whether the Chinese input problem needs to be solved Whether the control information added by the development team needs API17 and above Junit support Whether the version supports webview Support platform
Yes Yes Yes
can can not can
Yes no no
Java Java

almost all languages

no Yes no
Yes no Yes
Content Description resource-id Content Description
Yes no no
Junit4 Junit3 Junit3/Junit4
no Yes Yes
Android Android IOS

 

 

3. Supplementary content - three ways to inject events in Android

 

1. Use internal APIs (internal APIs are codes that Google has not opened to the outside world, and there are certain risks)

        Access the two event injection methods injectKeyEvent/injectPointerEvent by obtaining an instance of WindowManager. 

        在应用内可正常工作,在应用外不能正常工作(INJECT_EVENTS是需要系统权限的)。

2、使用instrumentation对象(开放的API,比内部API干净)

        通过instrumentation的一个实例来访问injectEvent,同上面的内部APIs的方法。

        所以在应用内部可以正常的工作,在应用外部不嫩正常的工作。

3、直接注入事件到设备 /dev/input/eventX

        linux以系统设备的方式向用户暴露了一套统一的事件注入接口 /dev/input/eventX(其中X代表一个整数)。我们可以直接调用。
        需要rooted过的设备,如:
        adb shell
        su

http://blog.csdn.net/lv18092081172/article/details/52123470
        chmod 666 /dev/input/event3

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326921512&siteId=291194637