2011年9月16日金曜日

Android Monkey ツールを試してみた


MonkeyツールはランダムなUIイベントを発生させて、アプリケーションのストレステストとかを行えるツール。

とりあえず以下を参考にコマンド打ってみた。

http://www.taosoftware.co.jp/blog/2009/04/android_monkey.html
https://sites.google.com/site/androidtestclub/translation/dev-guide/developing/tools/09-developing-tools-monkey

$ adb shell monkey -p com.your.package --throttle 1000 -v 500

なぜかOperaがクラッシュしてすぐに止まった。。

:Monkey: seed=0 count=500
:AllowPackage: com.your.package
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 15.0%
//   1: 10.0%
//   2: 15.0%
//   3: 25.0%
//   4: 15.0%
//   5: 2.0%
//   6: 2.0%
//   7: 1.0%
//   8: 15.0%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.your.package/.MyActivity;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.your.package/.MyActivity } in package com.your.package
:Sending Pointer ACTION_MOVE x=-4.0 y=2.0
:Sending Pointer ACTION_UP x=0.0 y=0.0
// CRASH: com.opera.browser (pid 3808)
// Short Msg: java.lang.UnsatisfiedLinkError
// Long Msg: java.lang.UnsatisfiedLinkError: logD
// Build Label: samsung/SC-01C/SC-01C/SC-01C:2.2/FROYO/OMKB1:user/release-keys
// Build Changelist: OMKB1
// Build Time: 1297069177000
// java.lang.UnsatisfiedLinkError: logD
// at com.opera.common.CommonNatives.logD(Native Method)
// at com.opera.common.Log.d(Unknown Source)
(中略)
//
** Monkey aborted due to error.
Events injected: 23
:Dropped: keys=0 pointers=0 trackballs=0 flips=0
## Network stats: elapsed time=7480ms (0ms mobile, 7480ms wifi, 0ms not connected)
** System appears to have crashed at event 23 of 500 using seed 0

が、その後は快調!
イベント回数5000、スロットル(イベント発生間隔)1000ミリ秒で実行した所、
20分以上アプリを動かしつづけてくれました。

$ adb shell monkey -p com.your.package --throttle 1000 -v 5000
:Monkey: seed=0 count=5000
:AllowPackage: com.your.package
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 15.0%
//   1: 10.0%
//   2: 15.0%
//   3: 25.0%
//   4: 15.0%
//   5: 2.0%
//   6: 2.0%
//   7: 1.0%
//   8: 15.0%
(中略)
Events injected: 5000
:Dropped: keys=2 pointers=2 trackballs=0 flips=0
## Network stats: elapsed time=1274086ms (0ms mobile, 1274086ms wifi, 0ms not connected)
// Monkey finished

0 件のコメント: