I hope you can achieve this using the following methods:
- There is a tool called the monkey runner and its open source that helps you record test cases. You can use the actual physical device to automate test cases.
- This is a very easy way you can try. you can put journal entries in all the life cycles of your activity, I mean onCreate, onStart, onStop, onResume, onRestart, onDestroy .... this will help you find out if your activity is in the foreground or in the background or successfully launched. To do this, you need to check the log output. Hope this helps you.
source share