Aug 9, 2017 · 1 min read
Correct.
However, you can use executeShellCommand() only from API level 21. And even on later versions, clearing data can’t be executed, as you said. You will kill your own running process. This is why we had to think about workaround and combine our tests execution with bash scripting and adb commands.
Beside this, we wanted more flexibility of being able running some shell commands before and after our tests without having rooted device. For example, we record a video and fetch it, we collect logs and dump netstats for each test, and more. executeShellCommand isn’t helpful in most of the cases. We tried ;)
