"The test failed to complete. Reason:" The toolkit could not be completed due to "The process crashed." When running multiple test boxes

I wrote a test project for testing an Android application (Application Under Test - my own project). I get the following crash in the console as well as in Junit View.

The test failed. Reason: “The toolkit could not be completed because the“ Process crashed. ”Check the device’s log code for details

But log-cat has no exception or anything else. The log looks just like a successful simple application launch. When I debug a test, it fails with the teardown () method in the following line:

        solo.finishOpenedActivities();

But nothing reflects on log-cat. In addition, this failure is not uniform for all test runs. Sometimes it crashes after the first test test and once before the first test.

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 5.2.1 and correctly imported into the project. Also works successfully for other applications. Here are the lines that are printed in the 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
+4
source share
1 answer

I have a problem. Testing tools cannot test an application that has a System.exit (0) command for disposal.

, tearDown(), solo.finishOpenedActivities() ().

solo.finishOpenedActivities() , onDestroy() . System.exit(0) onDestroy(), Dalvik (, ), Runner Instrumentation.

System.exit(0); unit test .

+2

All Articles