title: Android Junit Testing Freezes
body: <p>I have an android app that I am unit testing. I have 4 test classes each with multiple test methods. I run them all at the same time from a test suite. I ran into a problem on the emulator where the test would just freeze in the middle of running the tests. I switched to using an actual device and the problem went away.</p>
  
  <p>Fast forward a few weeks and I'm not having the same problem while running tests on my device. I have been on Google for the last couple days trying to find a solution but nothing I have found has helped.</p>
  
  <p><strong>The Issue</strong><br>
  When I try to run all the tests the test will freeze eventually. And by freeze I mean the test itself freezes. I saw one solution that it might be the phone or eclipse. I restarted my phone, updated everything in eclipse including eclipse itself. I tried changing views to see if maybe the eclipse view was not refreshing but none of that helped. I also tried using the junit v4 library instead of v3.</p>
  
  <p>If I run the test methods individually they all run and pass. Its only when I run them all from the test suite that they fail.</p>
  
  <p><strong>The Log</strong><br>
  I checked the log and this is what I get:<br>
  <code>03-13 12:11:04.526: I/TestRunner(23175): started: testCheckShowDialogEnabled(com.package.name.MainActivityTest)</code></p>
  
  <p>after that there is nothing else in the log.</p>
  
  <p><strong>On The Device</strong><br>
  The app is finished and is removed from the screen. It it not reopened again at the beginning of the next test.</p>
  
  <p><strong>The Code</strong><br>
  Here is the code that I think might be relevant. If you need any more code just let me know.</p>
  
  <pre><code>public class AllTests extends TestSuite {
      public static Test suite() {
          TestSuite suite = new TestSuite();
  
          suite.addTestSuite(MainActivityTest.class);
          suite.addTestSuite(DatabaseHandlerTest.class);
          suite.addTestSuite(ClassOneTest.class);
          suite.addTestSuite(AnotherActivityTest.class);
  
          return suite;
      }
  }
  
  public class MainActivityTest extends ActivityInstrumentationTestCase2&lt;MainActivity&gt; {
  
      public MainActivityTest() {
          super("com.package.name", MainActivity.class);
      }
  
      @Override
      public void setUp() throws Exception {
          super.setUp();
  
  
          mMainActivity = getActivity();
          mSolo = new Solo(getInstrumentation(), mMainActivity);
      }
  
      @Override
      protected void tearDown() throws Exception {
          super.tearDown();
  
          mMainActivity = null;
      }
      // all the test methods
  }
  </code></pre>
  
  <p>All my test classes implement <code>setup()</code> and <code>tearDown()</code> similarly.<br><br></p>
  
  <p>Anyone out there know why my tests keep freezing? Any help or suggestions are greatly appreciated.</p>