0

Is it possible to send messages from UIAutomator or adb to the application to be tested? I want to set test mode on to mock some data when running tests, but I want to make may code as little dirty as possible. When it's about unit testing it is rather easy, using just an additional parameter.

I found this approach but it would require adding lots of fluff in my code to send the is_testing parameter from the Activity to the Fragment and then to elsewhere.

A different approach would be uploading some file that the app reads when starting, but this solution is pretty ugly, too...

Is there any clean way to accomplish this?

Community
  • 1
  • 1
Luis
  • 2,833
  • 3
  • 27
  • 41

1 Answers1

0

Just send an Intent to your app

$ adb shell am start

Check am help.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Could you please elaborate your answer a little bit more? Checking the help I cannot see the point in using this approach... I cannot see any option that allows me to say my app that it's running in test mode. – Luis Mar 09 '15 at 21:42