Android - Benchmark Test

因為最近的工作是負責"驗貨",所以找了一些Android 上的測試工具。

APP Test Tools:

(1) Quadrant Standard : 有針對CPU、Memory、I/O、2D及3D的性能做測試。

(2) Linpack for android : 用於測試系统整體性能。

(3) Vellamo : Qualcomm目前則推出 Vellamo,提供測試Android平台在行動瀏覽的各類表現。

測試 Browser 部分:

(1)
測試網站 : SunSpider JavaScript Benchmark
網站介紹 : 由 WebKit Team 所釋出的 JacaScript 效能測試網站。

(2)
測試網站 :V8 Benchmark Suite
網站介紹 : Google 用來測試自家瀏覽器 的JavaScript 引擎。

(3)
測試網站 :Dromaeo JavaScript Performance
網站介紹 : Dromaeo 是由 Mozilla 所維護的效能測試網站。

可以參考這網址 網頁效能測試網站 ,還有很多測試網站的介紹!

Android - MonkeyRunner

The MonkeyRunner tool provides these unique features for Android testing:

1. Multiple device control:
The monkeyrunner API can apply one or more test suites across multiple devices or emulators.

2. Functional testing: 
Can run an automated start-to-finish test of an Android application. Provide input values with keystrokes or touch events, and view the results as screenshots.

3.Regression testing: 
Can test application stability by running an application and comparing its output screenshots to a set of screenshots that are known to be correct.

4.Extensible automation : 
Using the monkeyrunner API itself, you can use the standard Python os and subprocess modules to call Android tools such as Android Debug Bridge.

The monkeyrunner API is contained in three modules in the package com.android.monkeyrunner:

MonkeyRunner: A class of utility methods for monkeyrunner programs.

MonkeyDevice: Represents a device or emulator. This class provides methods for installing and uninstalling packages, starting an Activity, and sending keyboard or touch events to an application.

MonkeyImage: Represents a screen capture image. This class provides methods for capturing screens, converting bitmap images to various formats and writing an image to a file.

Running monkeyrunner

Android - Monkey Tool

Monkey Tool 是可以模擬使用者 clicks, touches, or gestures 等操作來對 APK 進行壓力測試。 

Monkey Tool 算是提供簡單的基本測試。如果需要更多的功能測試可以使用 Monkey 的升級版 MonkeyRunner.

Monkey Tool command :
$ adb shell monkey -p your.package.name -v test_count --throttle 500
or
$ adb shell monkey --help
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
              [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
              [--ignore-crashes] [--ignore-timeouts]
              [--ignore-security-exceptions]
              [--monitor-native-crashes] [--ignore-native-crashes]
              [--kill-process-after-error] [--hprof]
              [--pct-touch PERCENT] [--pct-motion PERCENT]
              [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
              [--pct-nav PERCENT] [--pct-majornav PERCENT]
              [--pct-appswitch PERCENT] [--pct-flip PERCENT]
              [--pct-anyevent PERCENT]
              [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
              [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
              [--wait-dbg] [--dbg-no-events]
              [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
              [--port port]
              [-s SEED] [-v [-v] ...]
              [--throttle MILLISEC] [--randomize-throttle]
              [--profile-wait MILLISEC]
              [--device-sleep-time MILLISEC]
              [--randomize-script]
              
Besides, 因為 APK Crash 會導致 Monkey test 的的停止,所以也可以增加 --ignore crashes.
還有另一個方法,Monkey 有提供一些函数如下: