I am running UIAutomation for android using Robotium and ActivityInstrumentationTestCase2. I have a test suite with 5 tests. Sometimes my test randomly crash because a test starts, once the previous test has not ended yet. Is there a way to avoid this? is it possible to manually add a 10 second delay before every test to get away from this horrible annoying bug?
EDIT:
public class MyTest<T extends RoboActivity> extends ActivityInstrumentationTestCase2<T>
{
protected Solo solo;
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
try {
solo.finalize();
}
catch (Throwable e) {
Assert.fail(e.getMessage()+ e.toString());
e.printStackTrace();
}
super.tearDown();
}
}
Maybe this could work :
mSolo = new Solo(getInstrumentation(), getActivity());
mSolo.waitForActivity(AccountDetail.class);
Seems that waitFor* methods are managing that better than a "sleep" http://robotium.googlecode.com/svn/doc/com/robotium/solo/Solo.html#waitForActivity(java.lang.Class, int)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With