只有apk文件例如Music.apk,写Robotium测试程序,具体步骤如下:
1)New-Project-Android Test Project,建立ExampleApplicationTesting项目。
方法: http://code.google.com/p/robotium/wiki/RobotiumForAPKFiles。
2)uninstall apk文件。
cd /home/validation/Sign
adb pull /system/app/Music.apk
1046 KB/s (529373 bytes in 0.493s)
ExampleApplicationTesting.apk在workspace/ExampleApplicationTesting/bin
adb uninstall com.android.music
Success
adb uninstall com.Example.ApplicationTesting
Success
3)修改ExampleApplicationTesting.apk和Music.apk的签名。
解压缩xxx.apk,删除目录META-INF,将整个文件夹用zip工具,重新打包成zip压缩包,然后更改后缀为apk (注意:产生的PhoneBook.zip中没有二级根目录)。
zip -r xxx.zip *
jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android xxx.zip androiddebugkey
cd ExampleApplicationTesing.apk_FILES
./zipalign 4 xxx.zip xxx.apk
4)把新签名的apk文件install。
adb install Music.apk
875 KB/s (449472 bytes in 0.501s)
pkg: /data/local/tmp/Music.apk
Success
adb install ExampleApplicationTesing.apk
561 KB/s (33547 bytes in 0.058s)
pkg: /data/local/tmp/ExampleApplicationTesing.apk
Success
5)Run As Android JUnit Test。
1)New-Project-Android Test Project,建立ExampleApplicationTesting项目。
方法: http://code.google.com/p/robotium/wiki/RobotiumForAPKFiles。
2)uninstall apk文件。
cd /home/validation/Sign
adb pull /system/app/Music.apk
1046 KB/s (529373 bytes in 0.493s)
ExampleApplicationTesting.apk在workspace/ExampleApplicationTesting/bin
adb uninstall com.android.music
Success
adb uninstall com.Example.ApplicationTesting
Success
3)修改ExampleApplicationTesting.apk和Music.apk的签名。
解压缩xxx.apk,删除目录META-INF,将整个文件夹用zip工具,重新打包成zip压缩包,然后更改后缀为apk (注意:产生的PhoneBook.zip中没有二级根目录)。
zip -r xxx.zip *
jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android xxx.zip androiddebugkey
cd ExampleApplicationTesing.apk_FILES
./zipalign 4 xxx.zip xxx.apk
4)把新签名的apk文件install。
adb install Music.apk
875 KB/s (449472 bytes in 0.501s)
pkg: /data/local/tmp/Music.apk
Success
adb install ExampleApplicationTesing.apk
561 KB/s (33547 bytes in 0.058s)
pkg: /data/local/tmp/ExampleApplicationTesing.apk
Success
5)Run As Android JUnit Test。