title: Running UiAutomatorTestcase in AndroidJunit Test Project
body: <p>I'm actually trying to implement a simple test suite within an AndroidJunit Test project which uses the following class</p>
  
  <ul>
  <li>UiObject</li>
  <li>UiSelector</li>
  <li>UiAutomatorTestcase</li>
  </ul>
  
  <p>to click and open the Messaging application on the Android Device and run it as AndroidJunit Test in Eclipse.</p>
  
  <p>While running the code I'm get the following exception</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Stub!</p>
  </blockquote>
  
  <p>I don't understand where I'm going wrong. Please let me know whether we can run the UiAutomatorTestcase test suite using the AndroidJuint Test project or not.</p>
  
  <p>Here is the sample code and the failure trace </p>
  
  <pre><code>public class UiautomatorTest extends
          ActivityInstrumentationTestCase2&lt;MyMainActivity&gt; {
  
      UiAutomatorTestCase mUiAutomatorTestCase;
  
      public UiautomatorTest() {
          super(MyMainActivity.class);`enter code here`
          // TODO Auto-generated constructor stub
      }
  
      @Override
      protected void setUp() throws Exception {
          // TODO Auto-generated method stub
          super.setUp();
          mUiAutomatorTestCase = new UiAutomatorTestCase();
      }
  
      public void testToOpenMessageApp() throws UiObjectNotFoundException {
          UiObject message = new UiObject(
                  new UiSelector().description("Messaging"));
          message.clickAndWaitForNewWindow();
  
          UiObject composeMessage = new UiObject(
                  new UiSelector().description("compose"));
          composeMessage.clickAndWaitForNewWindow();
  
          UiObject typeMessage = new UiObject(
                  new UiSelector().description("Type Message"));
          typeMessage.clickAndWaitForNewWindow();
          mUiAutomatorTestCase.getUiDevice().pressHome();
  
      }
  
  }
  </code></pre>
  
  <p>The stacktrace      </p>
  
  <pre><code>java.lang.RuntimeException: Stub!
  at mypackagename.UiAutomatorTestCase.&lt;init&gt;(UiAutomatorTestCase.java:5)
  at mypackagename..setUp(UiautomatorTest.java:25)
  at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
  at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
  at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
  at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
  </code></pre>