如何运行对一个发布版本的Andr​​oid APK / Robotium仪器测试案例? [英] How to run Android/ Robotium Instrumentation test cases against a release version APK?

查看:159
本文介绍了如何运行对一个发布版本的Andr​​oid APK / Robotium仪器测试案例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android项目设置与它的纯Java 的在PC上运行单元测试项目,并在模拟器中运行它的功能/集成测试项目。这两个化妆用 InstrumentationTestCase2 测试案例,也Robotium框架。我能够运行这两个从Eclipse中,针对在调试我的应用版本,并收集结果等。

我能够创建一个发布APK既直通Eclipse的出口和Ant构建。 APK签订后,经过zipalign处理和混淆。

我想知道如何对运行在发布这些功能/集成测试我的应用程序版本,而不是调试之一。我知道,因为应用程序项目包含可能已被Proguard的剥离出来的一些唯一的测试类我可能会在一些错误encur,但是我可以搞定。

我搜索谷歌和这里的SO,但没有运气。这里只有一个网页。这里涉及与Robotium测试当你只有应用的APK,没有源。我不知道这会真的帮助我。
我该如何获得测试项目兑发布APK?

在设备上运行
解决方案

  1. 登入都被测发布应用程序和测试应用程序Robotium用
    您释放键

  2. 您的设备上安装这两个应用

  3. 使用以下命令运行测试:

亚行外壳上午仪器-w com.your.package / android.test.InstrumentationTestRunner

在哪里com.your.package是你的包名。

查看Robotium Q&安培; A更多信息:的http:// code.google.com / p / robotium /维基/ QuestionsAndAnswers

正如你提到的,你可能也有一定的Proguard问题取决于你如何写你的测试用例。

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?

解决方案

  1. Sign both the release app under test and the test Robotium app with your release key
  2. Install both apps on your device
  3. Run tests using the following command:

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.

这篇关于如何运行对一个发布版本的Andr​​oid APK / Robotium仪器测试案例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆