I made my test-runner inherit from InstrumentationTestRunner and took the extra data in onCreate():admin管理员组文章数量:1642517
public class DepponTestRunner extends InstrumentationTestRunner {
public static String BAR;
public void onCreate(Bundle arguments) {
if (null != arguments) {
BAR = (String) arguments.get("foo"));
}
super.onCreate(arguments);
}
}
I added to Android.mk:
LOCAL_JAVA_LIBRARIES := android.test.runner
And to AndroidManifest.xml:
<instrumentation
android:name="com.example.MyTestRunner"
android:targetPackage="com.example" />
Ran it using this command line:
adb shell am instrument -e class test类全名\#方法名 -e foo june123456789asdfghjklqwertyuiopzxcvbnm -e bert june123 -w com.deppon.app.june.test/deppon.util.DepponTestRunner
本文标签: TestfunctiondeliverparametersShell
版权声明:本文标题:How can I deliver parameters to a test function, that launched using adb shell am Instrumentation co 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1729331644a1196463.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论