title: How can I automate a test that sends multiple mock intents to an Android activity?
body: <p>I am trying to send mock intents to an Android activity via the Android instrumentation tools and Android JUnit in Eclipse.</p>
  
  <p>I am able to successfully create a test that sends one <code>Intent</code> to an <code>Activity</code>, but I want to automate this and send several consecutive <code>Intents</code> so I can test the <code>Activity</code> with many pieces of data put in as an "extra" in the <code>Intent</code>.
  My code (which works for a single Intent) is as follows:</p>
  
  <pre><code>public class SearchTest extends ActivityInstrumentationTestCase2&lt;SearchResults&gt; {
  
      private ListActivity mActivity;
      private ArrayList&lt;String&gt; testManifest = new ArrayList&lt;String&gt;();
      TextView tv; 
  
  
      public SearchTest() {
          super("org.fdroid.fdroid", SearchResults.class);
      }//SearchTest
  
      @Override
      protected void setUp() throws Exception{
          setUpTestManifest();
          super.setUp();
          setActivityInitialTouchMode(false);
          Intent i = new Intent(Intent.ACTION_SEARCH);
          i.setClassName("org.fdroid.fdroid", "org.fdroid.fdroid.SearchResults");
          i.putExtra(SearchManager.QUERY, testManifest.get(0));
          setActivityIntent(i);
          mActivity = getActivity();
          tv = (TextView) mActivity.findViewById(R.id.description);
      }//setUp
  
      public void testSearchResult(){
          assertTrue(mActivity.getListView().getCount() &gt; 0);
      }//testSearchResult
  
      public void setUpTestManifest(){
          //populate the test manifest
          testManifest.add("Sample Key Word 1");
          testManifest.add("Sample Key Word 2");
          testManifest.add("Sample Key Word 3");
      }//setupManifest
  
  }//SearchTest 
  </code></pre>
  
  <p>How can I make this work where I can have hundreds of items in the <code>testManifest</code> and create an Intent and test for each of those items?</p>