I wrote a test project for testing an android application(Application Under Test is my own project). I get the following failure in console as well as in Junit View.
Test failed to run to completion. Reason: 'Instrumentation run failed due to 'Process crashed.''. Check device log-cat for details
But log-cat does not have a single exception or anything. Log seems same as a successful simple run of application. When i debug the test it fails at teardown() method at following line:
solo.finishOpenedActivities();
But nothing is reflected on log-cat. Additionally this failure is not uniform for all the test runs. Sometime it fails after first testcase and sometime before first testcase.
public class MainActivityTest extends
ActivityInstrumentationTestCase2<MainActivity> {
private Solo solo;
public MainActivityTest() throws ClassNotFoundException {
super(MainActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void testActivityProperlyDisplayed() throws Exception {
getInstrumentation().waitForIdleSync();
if (getActivity().getActionBar() != null) {
assertFalse("ActionBar is shown", getActivity().getActionBar()
.isShowing());
} else {
throw new AssertionFailedError("ActionBar not showing");
}
}
public void test2(){}
public void test3(){}
// and so on
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown();
}
}
Robotium version is 5.2.1 and is properly imported in project. Also successfully running for other applications. Here's the lines that are printed in console
[2014-07-29 14:19:38 - XMClientTest] Launching instrumentation android.test.InstrumentationTestRunner on UOQ1GYHIQ4
[2014-07-29 14:19:43 - XMClientTest] Sending test information to Eclipse
[2014-07-29 14:19:49 - XMClientTest] Test run failed: Instrumentation run failed due to 'Process crashed.'
[2014-07-29 14:19:49 - XMClientTest] Test run finished