UiAutomator changing variables

五迷三道 提交于 2019-11-29 18:13:05

If I understand your question, you have variables that change. You want your test to get these variables without hardcoding it? If that is the case, I would try this.

You can send in parameters via command line:

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

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