title: Android - InstrumentationTestRunner
body: <p>I'm new to Android and a bit rusty on Java, coming from a .NET background. I'm developing some test automation for a mobile application running on Android.</p>
  
  <p>Currently, I'm just launching the tests via the command line using the Android Debug Bridge, but I'm getting an error when I attempt to run any tests:</p>
  
  <p>First off, this is the error I'm receiving:</p>
  
  <blockquote>
    <p>junit.framework.TestSuite$1: 
    Failure in warning:
    junit.framework.AssertionFailedError: <strong>No tests found in
    com.myapp.test.UITests</strong>
            at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
            at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
            at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
            at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)</p>
  </blockquote>
  
  <p>I'm using this adb command to attempt to launch the test (on a rooted device):</p>
  
  <blockquote>
    <p>adb shell am instrument -e class com.myapp.test.UITests -w com.myapp.test/android.test.InstrumentationTestRunner</p>
  </blockquote>
  
  <p>Finally, here is the class I'm attempting to run tests from:</p>
  
  <pre><code>package com.myapp.test;
  
  import android.app.Activity;
  import android.test.ActivityInstrumentationTestCase2;
  import com.jayway.android.robotium.solo.Solo;
  import junit.framework.Assert;
  
  @SuppressWarnings("unchecked")
  public class UITests extends ActivityInstrumentationTestCase2
  {
      private static final String TARGET_PACKAGE_ID = "com.myapp.main";
      private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.myapp.main.activities.MainActivity";
      private static Class&lt;?&gt; launcherActivityClass;
  
      private Solo solo;
      private Activity activity;
  
      static 
      {
          try
          {
              launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
          }
          catch(ClassNotFoundException e)
          {
              throw new RuntimeException(e);
          }
      }
  
      public UITests() throws ClassNotFoundException
      {
          super(TARGET_PACKAGE_ID, launcherActivityClass);
      }
  
      @Override
      protected void setUp()
      {
          activity = getActivity();
          solo = new Solo(getInstrumentation(), activity);
  
      }
  
      @Override
      public void runTest() throws Throwable
      {
          // Simple Test
          Assert.assertTrue(solo.searchText("Welcome"));
      }
  
      @Override
      protected void tearDown() throws Exception
      {
          try
          {
              solo.finalize();
          }
          catch(Throwable e)
          {
          }
          getActivity().finish();
          super.tearDown();
      }
  
  }
  </code></pre>
  
  <p>I must be doing something wrong, but I'm not sure what. I've based my code on an <a href="http://code.google.com/p/robotium/wiki/Getting_Started">example</a> I found on the Robotium site.</p>
  
  <p>I'd greatly appreciate if anyone could point out my mistake.</p>
  
  <p><strong>Update - Adding Manifest file as requested</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.myapp.test"
            android:versionCode="1"
            android:versionName="1.0"&gt;
  
      &lt;uses-sdk android:minSdkVersion="3" /&gt;
  
      &lt;application android:icon="@drawable/icon" android:label="@string/ws_app_name"&gt;
          &lt;uses-library android:name="android.test.runner" /&gt;
      &lt;/application&gt;
  
      &lt;instrumentation android:name="android.test.InstrumentationTestRunner"
                       android:targetPackage="com.myapp.main"
                       android:label="My App Tests"/&gt;
  &lt;/manifest&gt;
  </code></pre>