5

I ran the Monkey tool (the tool to perform stress testing on Android application) and I got some script file that have this form:

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)
...

I would like to re-execute such sequence of events again, using the produced script. How can I do that?

giograno
  • 1,749
  • 3
  • 18
  • 30

1 Answers1

6

You will need adb for the same. First you will create the file on your local

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)

Then you will copy it to your phone

adb push ./monkey.script /sdcard/Download

And then you can run the script from 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)
Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • Any explanation on the downvote? Please comment while downvoting. This has been tested before posting – Tarun Lalwani Apr 20 '18 at 09:27
  • thankyou for suggesting the script. Can you please give me some link or material to study further. I am also working on automation and need help – Ravi May 09 '20 at 03:35
  • You can start here https://www.youtube.com/watch?v=Vt8EUQtqBuA – Tarun Lalwani May 09 '20 at 06:49
  • I checked the video, Actaully I need documentation for the command which I can use in my script – Ravi May 09 '20 at 10:30
  • I checked the video, Actually I need documentation for the command which I can use in my script, like what does "GUIGen" command means and what is the meaning of count = -1 in your code. – Ravi May 09 '20 at 10:40