Issue
I'm trying to create a test method using Robotium to check if the Android application finishes after clicking on a button (in the code there is a call to finish()
when the user taps on it).
public void test_onclickExit_finish() {
String buttonText = resources.getString(R.string.exit);
Button exitButton = solo.getButton(buttonText, true);
solo.clickOnView(exitButton);
// check here that the app has finished
// wait for the activity to finish?
assertTrue(solo.getCurrentActivity() == null);
}
But this test is failing. I don't know how can I indicate the test to wait till the activity has finished. Also I'm not sure if using getCurrentActivity()
would be a good way to check if the app has finished.
How can I check that the application/ activity has finished?
Thanks.
Solution
Application and instrumentation are running in the same process, if you finish your application, you cannot do anything more in instrumentation. It failed, because instrumentation was killed as well, and you tried to do something more. There is no way to check what you are trying to do with robotium.
Answered By - maszter
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.