Search This Blog

Saturday, February 14, 2015

MonekyRunner

great tool to run stress test on your app.

i use to get the x,y location via monkey_recorder (you can read it here test automation)

monkeyrunner.bat -v ALL  D:\MyStuff\Android\monkey_runner\monkey_recorder.py

this open UI , and the log on the x,y.
you can run the export log via
monkeyrunner.bat -v ALL  monkey_playback.py  savedLog.mr

i like to use the python script.
in my script i get memory status via

procInfo= str(device.shell('dumpsys meminfo yaniv.ezphone.com'))
print procInfo

to use long click i used this pattern (down,sleep,up)

device.touch(270, 188, MonkeyDevice.DOWN)
MonkeyRunner.sleep(1)
device.touch(270, 188, MonkeyDevice.UP)


Dalvik Heap Profiling

have a look at this post
http://stackoverflow.com/questions/25795458/is-it-possible-to-trigger-an-android-heap-dump-from-the-command-line
watch this video from 35 minutes Android Development Tools 

from code you can use Debug.dumpHprofData()
from adb you can use kill -10   explain well here -> Dalvik Heap Profiling


adb am dumpheap


use this link to get more info heap-profiling

From a shell you can do the following to get a heap dump for the application using adb.
Note: Replace 19000 with the process ID of your running application. The filepath must be a filepath which your application has write access to on the Android device.
Create a heap dump:
adb shell am dumpheap 19000 /sdcard/Documents/android.hprof
Pull the file to your machine:
adb pull /sdcard/Documents/android.hprof
Convert to a hprof file readable by an analyzer:
hprof-conv android.hprof mat.hprof
Tips: Get process ID of your application:
adb shell ps | grep com.sample.application | cut -c10-15
Get process ID and dump heap:
adb shell am dumpheap `adb shell ps | grep com.sample.application | cut -c10-15` /sdcard/Documents/android.hprof