Reputation: 11
I've done automation using Instrumentation for MusicPlayer, now I would like to use Android MonkeyRunner inside my test classes to pass on some events and for taking screen shots, can anyone throw their lights on this if they had done this?
Thanks in advance, Sha
Upvotes: 1
Views: 1038
Reputation: 3476
Monkeyrunner can be used to install the instrumented package and execute the tests but not interact they way you describe.
Upvotes: 2
Reputation: 1485
Great question! I had the same one when I first learned of monkeyrunner. However, monkeyrunner script is not meant to run inside of your test classes. From the monkeyrunner page:
The monkeyrunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code.
You write monkeyrunner script on your PC and it uses adb to communicate with a device/emulator. monkeyrunner can, however, still be used to do the things you want... just not from within Android test classes.
Does it make sense to have monkeyrunner install your test application, run the instrumentation, and then take a screenshot? If something like that will work for you then take a quick look at the page I linked above... it has a decent example.
Upvotes: 4