重现Android Monkey Script

我运行了Monkey工具(在Android应用程序上执行压力测试的工具),我得到了一些具有以下形式的脚本文件:

type= raw events
count= -1
speed= 1.0
start data >>
LaunchActivity(com.amaze.filemanager,com.amaze.filemanager.activities.MainActivity)
DispatchPointer(6934862,6934862,0,517.0,124.0,0.0,0.0,0,1.0,1.0,0,0)
DispatchPointer(6934862,6934867,1,520.041,127.07279,0.0,0.0,0,1.0,1.0,0,0)
GUIGen(3)
DispatchTrackball(-1,6945789,2,1.0,-3.0,0.0,0.0,0,1.0,1.0,0,0)
...

我想使用生成的脚本再次重新执行这样的事件序列.
我怎样才能做到这一点?

解决方法:

你需要adb同样的东西.首先,您将在本地创建该文件

monkey.script

type= raw events
count= -1
speed= 1.0
start data >>
LaunchActivity(com.amaze.filemanager,com.amaze.filemanager.activities.MainActivity)
DispatchPointer(6934862,6934862,0,517.0,124.0,0.0,0.0,0,1.0,1.0,0,0)
DispatchPointer(6934862,6934867,1,520.041,127.07279,0.0,0.0,0,1.0,1.0,0,0)
GUIGen(3)
DispatchTrackball(-1,6945789,2,1.0,-3.0,0.0,0.0,0,1.0,1.0,0,0)

然后,您将其复制到手机上

adb push ./monkey.script /sdcard/Download

然后你可以从adb运行脚本

$adb shell monkey -f /sdcard/Download/monkey.script 1
Events injected: 4
## Network stats: elapsed time=10ms (0ms mobile, 0ms wifi, 10ms not connected)
上一篇:monkey--常用参数


下一篇:如何在没有物理键的Android系统上使用monkey命令?