参数uiAutomator测试类 [英] Parameters to uiAutomator test class

查看:193
本文介绍了参数uiAutomator测试类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来uiAutomator。我试过的参数传递给方法,它运行,但根本不理会任何东西传递给它。
只是想知道我们是否可以传递任何参数测试类或测试方法uiAutomator?

I am new to uiAutomator. I tried passing the parameters to method, it run but just ignores anything passed to it. Just wondering whether we can pass any arguments to test class or test method in uiAutomator?

推荐答案

<一个href=\"http://stackoverflow.com/questions/20789124/uiautomator-changing-variables/20985597#20985597\">Reference

您可以在参数通过命令行发送:

You can send in parameters via command line:

adb shell am insrument -e <NAME> <VALUE> <package/runner>

您可以使用捆绑若您覆盖 onCreatemethod 的InstrumentationTestRunner。

You can access the value using the bundle that is available if you override the onCreatemethod of the InstrumentationTestRunner.

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  value = (String) savedInstanceState.get("name");
}

这篇关于参数uiAutomator测试类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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