Gradle: android instrumentation test without app source code

半城伤御伤魂 提交于 2019-12-22 06:37:54

问题


Before using gradle, it seems easy to do some black box testing with robotium or other instrumentation based automation framework, just need to indicate the targetPackage in AndroidManifest.xml

<instrumentation
    android:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    android:targetPackage="xxxx" />

However gradle expects a project structure like this:

src/main/
src/androidTest/

It simply use the app built from main (source code) as test target.

And according to Gradle Plugin User Guide

The value of the targetPackage attribute of the instrumentation node in the test application manifest is automatically filled with the package name of the tested app, even if it is customized through the defaultConfig and/or the Build Type objects. This is one of the reason this part of the manifest is generated automatically.

Does it means with gradle we're not able to choose the targetPackage and test an app without source code? Or how to make gradle do the trick?

来源:https://stackoverflow.com/questions/28020893/gradle-android-instrumentation-test-without-app-source-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!