Christian
Christian

Reputation: 7852

My Android unit test never completes in Eclipse

When running a unit test (Run as Android JUnit test) it never completes. Output:

[2011-03-03 21:45:43 - TestMyProj] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554

[2011-03-03 21:45:43 - TestMyProj] Collecting test information

[2011-03-03 21:45:47 - TestMyProj] Sending test information to Eclipse

[2011-03-03 21:45:47 - TestMyProj] Running tests...

...and nothing more. Code:

public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

   public MainActivityTest() {
       super("my.app.MainActivity", MainActivity.class);
   }
   private MainActivity mActivity;
   @Override
   protected void setUp() throws Exception {
      super.setUp();
      mActivity = this.getActivity();
   }
   public void testOneEqualsOne() {
      assertEquals(1,1);
   }
}

What could be wrong?

Kind regards, Christian

Upvotes: 1

Views: 719

Answers (1)

Diego Torres Milano
Diego Torres Milano

Reputation: 69198

The constructor you are using is deprecated. This may not be the root cause of the problem but it might help. Use:

   public MainActivityTest() {
       super(MainActivity.class);
   }

Upvotes: 1

Related Questions