I would like to start an instrumentation test written with espresso on my physical device from the physical device.
The idea is the following: My company has a white label solution for an app, so we have a lot of apps to put into the Play Store. To support our support team, I have written a test which makes screenshots of several parts of the app, so they don't have to do that every time.
Problem: They can't launch the 'screenshot maker test' without having the android sdk installed, terminal open etc.
The best solution from my point of view would be to implement a secret button hidden in the application which starts the test after pressing it. Is that even possible?
I tried the following shell command from my computers terminal and it worked:
adb shell
am instrument -w -e class com.my.company.ScreenshotTests com.my.company.tests/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
But when I run that command with an Android Terminal Emulator app on the device it throws a SecurityException: Permission Denial: startInstrumentation asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL.
Do I have to root the device to achieve something? Or is it somehow possible without rooting?
If it's not possible to start the test from the application, it would also be helpful to just start it from a script or something. Basically the support team should just have to click a button and then the screenshots get taken automatically. Any ideas?