I have an Android project setup with its pure Java unit test project running on PC, and its functional/ integration test projects running on Emulator. Those two make use of InstrumentationTestCase2
test cases and also Robotium framework. I'm able to run those two from Eclipse, against the debug version of my app and collect results and so on.
I'm able to create a release APK both thru Eclipse export and Ant build. APK is signed, zipaligned and obfuscated.
I'd like to know how to run those functional/ integration test against the release version of my app, instead of the debug one. I know I might encur in some errors because app project contains some test-only classes that probably have been stripped out by Proguard, but I can handle that.
I searched on Google and here on SO, but with no luck. There's only a page here related to testing with Robotium when you only have app's APK, no source. I'm not sure this would really help me. How would I get the test project to run on the device against the release APK?
adb shell am instrument -w com.your.package/android.test.InstrumentationTestRunner
Where com.your.package is your package name.
See the Robotium Q&A for more info: http://code.google.com/p/robotium/wiki/QuestionsAndAnswers
As you mentioned, you might also have some Proguard issues depending on how you've written your test cases.
I'd like to know how to run those functional/ integration test against the release version of my app, instead of the debug one.
I came across this question while searching for a solution..
Since this is an old question with old answers, I shall give an updated answer for Gradle-based Android project.
What I did is:
android { testBuildType "release" }
buildTypes { release { minifyEnabled true proguardFiles 'proguard-rules.txt' testProguardFile('proguard-rules.txt') } }
Now try to run test against a release build. you may still encounter error due to proguard. if you are using Robotium, like I do, you can add the following line in your proguard-rules.txt file:
##--------------- Begin: proguard configuration for Robotium ----------
-keep class com.robotium.** { *;}
##--------------- End: proguard configuration for Robotium ----------
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With