Whitespace in custom args on Android instrument test run

140 Views Asked by At

I have this instrumented test suite in Android, that I would like to pass some custom arguments to. I've been using this format, as stated in the official documentation:

adb shell am instrument -w -e key value -e class com.testpackage.tests.TestClass#testMethod

Where for each custom argument there needs to be a -e key value pair.

This works well for arguments that are numbers or strings with no whitespace in it. However, when I try to pass an argument with whitespace in it, between quotes, double quotes or not, such as -e user_name "John Doe", it's not parsed correctly and I get the following error:

Error: No instrumentation found for: Doe

Which suggests the command is parsing user_name as John and trying to use Doe as the target test class or something.

Now, is this a limitation on this command? Or a bug? Is there any other way to achieve this?

0

There are 0 best solutions below