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?