Saturday, 29 September 2018

Running Instrumented Test with arguments using command prompt

I've an InstrumentedTest

@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext(String groupName) {
Context appContext = InstrumentationRegistry.getTargetContext();
        UiDevice device=UiDevice.getInstance(getInstrumentation());
...
...
  }
}

And I want to execute it using adb shell command. But I've to pass value of groupName parameter for the method useAppContext(String groupName)

I was using command

adb shell am instrument -w -r   -e debug false -e class 'com.<package_name>.ExampleInstrumentedTest' com.<package_name>.test/android.support.test.runner.AndroidJUnitRunner  

But how can I pass method parameters as arguments to the command running over command prompt?



from Running Instrumented Test with arguments using command prompt

No comments:

Post a Comment