开源的 Android 测试工具集合
本文主要是展示一系列的开源 Android 测试工具。每个工具都会有相应的简短介绍，还有一些相关的资源。Android 测试工具列表是按照字母来排序的，最后还会介绍几个不是特别活跃的 Android 测试相关的开源项目。
本 文提到的开源 Android 软件测试工具包括：Android Test Kit, AndroidJUnit4, Appium, calabash-android, Monkey, MonkeyTalk, NativeDriver, Robolectric, RoboSpock, Robotium, UIAutomator, Selendroid。
Android Test Kit
The Android Test Kit is the set of Google open source testing tools for Android that include the Espresso API that you can use to write concise and reliable Android UI tests
Web site: https://code.google.com/p/android-test-kit/
* Android application testing with the Android test framework – Tutorial
* Espresso for Android is here!
AndroidJUnit4 is a framework that allows to run JUnit4 tests on Android devices with Eclipse/ADT or command line tools.
Web site: https://github.com/esmasui/AndroidJUnit4
Appium is an open source test automation framework for use with native and hybrid mobile apps. Appium drives iOS and Android apps using the WebDriver JSON wire protocol. Appium’ philosophy is that testing native apps shouldn’t require including an SDK or recompiling your app. Appium aims to automate any mobile app from any language and any test framework, with full access to back-end APIs and DBs from test code. You can write tests with your favorite development tools with the Selenium WebDriver API and language-specific client libraries.
Web site: http://appium.io/
Calabash enables you to write and execute. Calabash is an open source tool to write automated acceptance tests of mobile apps that supports Android and iOS native apps. Calabash consists of libraries that enable test-code to programmatically interact with native and hybrid apps. The interaction consists of a number of end-user actions. Calabash could be compared to Selenium WebDriver. However, it is important to realize that interacting with a web app from a desktop computer is vastly different than interacting with a native app using a touch screen. Calabash provides APIs that are specialized to native apps running on touch screen devices.
* A better way to test Android applications using Calabash
* Calabash Android: query language basics
The Monkey is a open source software testing tool developed by Google that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test your apps in a random yet repeatable manner. The Monkey is a command-line tool that that you can run on any emulator instance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing. Monkey generates events and sends them to the system. It also watches the system under test and looks for three conditions, which it treats specially.
MonkeyTalk is an open source mobile app testing tool that automates real, functional interactive tests for iOS and Android apps – everything from simple “smoke tests” to sophisticated data-driven test suites. Native, mobile, and hybrid app, real devices or simulators. MonkeyTalk makes scenario capture easy as it records high-level, readable functional test scripts. The same commands can be used for iOS and Android apps. You can record a test on one platform and play it back on another. MonkeyTalk supports the mobile touch and gesture-based interactions that are central to the mobile experience. Swipe, Drag, Move – even finger-drawing can be recorded and played back.
NativeDriver is an implementation of the WebDriver API that drives of the UI of a native application rather than a web application.
Web site: https://code.google.com/p/nativedriver/
Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. Tests run inside the JVM on your workstation in second. Robolectric handles inflation of views, resource loading, and lots of other stuff that’s implemented in native C code on Android devices. This allows tests to do most things you could do on a real device. It’s easy to provide our own implementation for specific SDK methods too. Robolectric lets you run your tests on your workstation, or on your Continuous Integration environment in a regular JVM, without an emulator.
RoboSpock is an open source test framework for Android that provides an easy way of writing Behavior Driven Development (BDD) specifications with Groovy language and supports the Google Guice library. It combines two main solutions in the area: Robolectric and Spock framework.
Web site: http://robospock.org/
* RoboSpock – Behavior Driven Development (BDD) for Android
Robotium is an Android test automation framework that has full support for native and hybrid applications. Robotium makes it easy to write powerful and robust automatic black-box UI tests for Android applications. With the support of Robotium, test case developers can write function, system and user acceptance test scenarios, spanning multiple Android activities.
Web site: https://code.google.com/p/robotium/
* Robotium – Testing Android User Interface
* Android user interface testing with Robotium – Tutorial
The UIAutomator testing framework lets you test your user interface (UI) efficiently by creating automated functional UI test cases that can be run against your app on one or more devices.
Web site: http://developer.android.com/tools/help/uiautomator/index.html
* Automatic Android Testing with UiAutomator
Selendroid is a test automation framework that drives off the UI of Android native and hybrid applications (apps) and the mobile web. Tests are written using the Selenium 2 client. Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid for scaling and parallel testing.
Web site: http://selendroid.io/
* Mobile Test Automation with Selendroid
* Road to setup Selendroid and create first test script of android application
* Up and running with: Selendroid
Some discontinued projects of Android testing tools
A list of some seemingly discontinued open source projects (or at least not updated in recent months) for Android testing tools that you might want to check… and maybe taking back to life.
Emmagee is a practical, handy performance test tool for specified Android App, which can monitor CPU, memory and network traffic. Additionally, it also provides several cool features such as customizing interval of collecting data, rendering real-time process status in a floating window, and much more.
Web site: https://github.com/kevinkong/Emmagee
Scirocco is an open source Application testing tool from Sonix. You will be able to access necessary testing devices from Eclipse. Instead of hand operation, Scirocco provides automatic Android application’s testing functionalities. It supports Google NativeDriver and AndroidDriver as main testing library.