How to solve the test run failed: the launch of the toolbox failed due to a "native accident" in the robotium

I am trying to test JUnit, but ran into the following problem.

When I select Android JUnit Test, by right-clicking on the project, it will display the following message

Test run failed: Toolkit failed due to "Native crash"

and when I right-click on TestApk.java and select Android JUnit Test, it shows

Test run failed: instrumentation failed due to java.lang.ClassNotFoundException

There are two cases

Here is my source code.

@SuppressWarnings("unchecked")
public class TestApk extends ActivityInstrumentationTestCase2 {

      private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.nhn.android.ndrive";
      private static Class launcherActivityClass;
      static {

          try {
              launcherActivityClass = Class
                .forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
          } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
          }
      }

      public TestApk() throws ClassNotFoundException {
          super(launcherActivityClass);
      }

      private Solo solo;

      @Override
      protected void setUp() throws Exception {
         super.setUp();
         solo = new Solo(getInstrumentation(), getActivity());
      }

      public void testDisplayBlackBox() {
         //Enter any integer/decimal value for first editfield, we are writing  10
         solo.clickOnWebElement(By.id("com.nhn.android.ndrive:id/actionbar_photo_left_button"));
         solo.clickOnWebElement(By.id("com.nhn.android.ndrive:id/gnb_group_layout"));
         //Enter any integer/decimal value for first editfield, we are writing  20

         solo.clickOnWebElement(By.id("com.nhn.android.ndrive:id/actionbar_open_drawer_button"));
         //Click on Multiply button
         solo.clickOnButton("com.nhn.android.ndrive:id/base_menu_task_open_button");

        //Verify that resultant of 10 x 20
        //assertTrue(solo.searchText("200"));
       }

       @Override
       public void tearDown() throws Exception {
            solo.finishOpenedActivities();
       }

}

but the package name is not wrong.

How to solve this problem?

+4
source share

Source: https://habr.com/ru/post/1608295/


All Articles