Search code examples
androidparametersandroid-uiautomator

How to send and retrieve Command line parameters for Android UIAutomator latest version 2.1.2


How do we get command line parameters with new UIAutomator? Earlier we were passing command line params to a method in a class like this:

adb shell uiautomator runtest UiTest.jar -c package.name.ClassName -e paramKey paramValue

And in Code we were getting params by getParams() API since the class extends UIAutomatorTestCase Class. This class is deprecated now and getParams() method cannot be used.


Solution

  • You can use InstrumentationRegistry.getArguments() to retrieve the command line parameters.