title: Run espresso test multiple times
body: <p>Sometimes I faced with rare bug in my application. But I can't reproduce it as it's very rare. So, I decided to write simple espresso test:</p>
  
  <pre><code>@RunWith(AndroidJUnit4::class)
  @LargeTest
  class MainActivityTest {
  
      val password = "1234"
  
      @Rule @JvmField
      var mActivityRule: ActivityTestRule&lt;MainActivity&gt; = ActivityTestRule(MainActivity::class.java)
  
      @Test
      fun checkNotesListNotEmpty() {
          onView(withId(R.id.password_edit_text)).perform(typeText(password))
          onView(withId(R.id.notes_recycler_view)).check { view, noMatchingViewException -&gt;
              if (noMatchingViewException != null) throw noMatchingViewException
              assertThat((view as RecyclerView).adapter.itemCount,  Matchers.`is`(1))
          }
      }
  }
  </code></pre>
  
  <p>How can I loop this test and stop it when matching fails?</p>