I'm testing my Android application with Robotium and I'm facing one intermittent problem. My application starts with a SigninActivity which allows the user to signin and after that he is directed to the second activity which has a list that is filled after a request to a web server.
The first question is: since all my activities can only be accessed after the user is logged in, I need to start every test for every activity from the login screen. So what I'm doing is for every activity test class, I'm inheriting it from
ActivityInstrumentationTestCase2<SigninActivity>
and in the setUp method I'm loggin in the user. Is this the correct approach?
Second question: I want to test the list data in the second activity that is filled after a request to the web server. As mentioned above, in my setup method I login the user, and I use
solo.waitForActivity(SecondActivity.class, BIG_TIMEOUT)
solo.waitForView(ListView.class)
to guarantee that the second activity and the list are present. The problem is, even with this verification I often get
junit.framework.AssertionFailedError: Can not click on line number 2 as there are only 0 lines available