Is there a way to save the random run of Android Monkey into a script with the proper format to later replay it by running:
adb shell monkey -p <package_name> -f script_file 1
EDIT:
I know there is a seed flag (-s), but that's not what I want. I have to be able to work with the generated script before feeding it back to the Monkey.
Not an easy way, but you could do a reverse engineering on the monkey script source to create a script that takes the output of the monkey command and generates the monkey script.
So you could run:
adb shell monkey -p <package_name> -v -v 1 > monkey-logs.txtAnd then*:
convert-to-monkey-script.sh monkey-logs.txtFor example, one output of the monkey call:
Becomes the following monkey script (read the monkey source to understand better the arguments):
Which can be run with (with the content above in the monkey.script file and after a adb push):
adb shell monkey -p <package_name> -f monkey.script 1I've made a simple gist for myself that convert adb taps commands into monkey script format (because they're faster) here, so I think that is possible to make a general script for that.
*Note:
convert-to-monkey-script.shdoesn't exist. As I said, someone COULD do it