1

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?

arvere
  • 727
  • 1
  • 7
  • 21
  • `adb shell ...` commands are shell commands within a shell command. So I would recommend to encapsulate the whole `am instrument ..` call again in quotes/single quotes to make sure the quote are not resolved already in the outer shell call. – Robert Apr 25 '22 at 15:33
  • that's exactly the issue. thank you! please post as an answer :D – arvere May 03 '22 at 21:31

0 Answers0