標籤:
安裝python
http://pydev.org/updates
載入python.exe
jython 載入jython 包 , 載入Hier包 chilm包
》》》》》》》》》》》》》》》》》》》》》》》》》》
monkeyrunner 錄製回放指令碼,儲存為mr_rocorder.py
from com.android.monkeyrunner import MonkeyRunner as mr
from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder
device = mr.waitForConnection()
recorder.start(device)
運行monkeyrunner mr_rocorder.py
monkeyplayback.py
import sys
com.android.monkeyrunner import MonkeyRunner
# The format of the file we are parsing is very carfeully constructed.
# Each line corresponds to a single command. The line is split into 2
# parts with a | character. Text to the left of the pipe denotes
# which command to run. The text to the right of the pipe is a python
# dictionary (it can be evaled into existence) that specifies the
# arguments for the command. In most cases, this directly maps to the
# keyword argument dictionary that could be passed to the underlying
# command.
# Lookup table to map command strings to functions that implement that
# command.
CMD_MAP = {
""TOUCH"": lambda dev, arg: dev.touch(**arg),
""DRAG"": lambda dev, arg: dev.drag(**arg),
""PRESS"": lambda dev, arg: dev.press(**arg),
""TYPE"": lambda dev, arg: dev.type(**arg),
""WAIT"": lambda dev, arg: MonkeyRunner.sleep(**arg)
}
# Process a single file for the specified device.
def process_file(fp, device):
for line in fp:
(cmd, rest) = line.split(""|"")
try:
# Parse the pydict
rest = eval(rest)
except:
print ""unable to parse options""
continue
if cmd not in CMD_MAP:
print ""unknown command: "" + cmd
continue
CMD_MAP[cmd](device, rest)
def main():
file = sys.argv[1]
fp = open(file, ""r"")
device = MonkeyRunner.waitForConnection()
process_file(fp, device)
fp.close();
if __name__ == ""__main__"":
main()
運行monkeyplayback.py + 錄製的檔案名稱
安裝findbugs:http://findbugs.cs.umd.edu/eclipse 在eclipse中安裝
使用tcpdump及wireshark 抓包:
adb push <tcpdump path> /data/local/tcpdump
adb shell chmod 6755 /data/local/tcpdump
adb shell
cd /data/local
tcpdump -p -vv -s 0 -w /data/local/capture.pcap
adb pull /data/local/capture.pcap D:\
分析網路耗時、網路通訊協定 IP地址等
詳細查看TCP、ip協議卷一到卷三
eclipse + python + monkeyrunner環境搭建