setting up robotium rc for an apk in google play

goal: want to test an app available as apk from google play.

install app to test on the device
install android sdk and configure it to connect to your device (which is in usb debug mode etc)
install apk extractor from google play

open apk extractor
have it extract the apk for you app of interest
do “adb shell” on your windows machine from command prompt
in shell “cd sdcard” “cd ApkExtractor” “ls”
you now have the name and path to the extracted apk file
exit adb shell (just “exit” will do)

now you are back in your windows pc shell (command prompt)
now you need the path and filename of the apk you extracted and checked above
in windows command prompt execute “adb pull PATH_TO_FILE_ABOVE”
the extracted apk file is now in the directory on your windows pc whereever you executed the pull command

now, to use the apk file for testing with robotium, it must be re-signed with your debug key. for instructions see here: https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles. basically you download a re-signing application, run the apk through it to strip the signatures and to re-sign it with your debug key. if all is installed correctly it is like magic and no need to do anything but drag and drop the apk into the signer.

notice that the re-signer should tell you what package the app has and what is the main activity to start it. these are useful information to have when getting robotium up and running.
also, if you need to check the manifest.xml in the APK for some activity information etc I recommend looking for some form of apk extractor of android manifest extractor as there are some tools that give everything in there as readable, by default they are a bit “obfuscated” in the apk file (which opens fine with winzip etc)

now for running robotium rc to test your app, you naturally need to install robotium rc (doh):https://code.google.com/p/robotium/wiki/RemoteControl

to run your newly signed app use the following jre arguments: aut=PATH_TO_YOUR_NEW_DEBUG_APK messenger=C:\robotiumrc\SAFSTCPMessenger\bin\SAFSTCPMessenger-debug.apk runner=C:\robotiumrc\SAFSTestRunner\bin\SAFSTestRunner-debug.apk instrument=com.jayway.android.robotium.remotecontrol.client/com.jayway.android.robotium.remotecontrol.client.RobotiumTestRunner

that is assuming the normal robotiumrc install dir.

note that robotium rc will upload a fresh copy of the apk at every run with this. the first time you do this you may get an error about invalid or inconsistent certificates. manually uninstall the original apk from the device and have robotium re-install the new resigned apk and it should be fine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s