UiAutomator changing variables

后端 未结 1 1643

I\'ve got a test case that accesses the browser and does some stuff with it. But I need to programmatically change what the inputs are for some of the text boxes. I have 8 s

相关标签:
1条回答
  • 2020-12-22 07:35

    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");
    }
    
    0 讨论(0)
提交回复
热议问题