I writing test cases for Android apps using Robotium. One of my test cases opens a file (e.g., an image) which causes the opening of another activity from another app to display the image.
This far, everythings fine. However, afterwards, I want to get back to my activity under test, as I want to test further functionality.
How can I acchieve this?
Neither
solo.sendKey(android.view.KeyEvent.KEYCODE_BACK);
nor
solo.goBack();
nor
solo.getCurrentActivity().onBackPressed()
works because the activity displaying the image belongs to another app and thus, to another process.
Anything else I could try?
You are doing acceptance tests yes, this is to see that the UI of your system works.
You don’t need to test that the image is opened ( as this is outside of your app scope ).
however it would be recommended to have separate unit tests that assert that you call the correct intent (or whatever code snippet) to open this image.
That way you have the code covered by a test and non of the problems of testing other peoples code.