Manchmal habe ich mit seltenen Fehler in meiner Anwendung konfrontiert. Aber ich kann es nicht reproduzieren, da es sehr selten ist. So entschied ich mich einfach Espresso Test zu schreiben:Führen Sie espresso Test mehrmals
@RunWith(AndroidJUnit4::class)
@LargeTest
class MainActivityTest {
val password = "1234"
@Rule @JvmField
var mActivityRule: ActivityTestRule<MainActivity> = 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 ->
if (noMatchingViewException != null) throw noMatchingViewException
assertThat((view as RecyclerView).adapter.itemCount, Matchers.`is`(1))
}
}
}
Wie kann ich Schleife dieser Test und es stoppen, wenn passender nicht funktioniert?
Versuchen 'Spaß checkNotesListNotEmpty() throws InterruptedException' – piotrek1543
@ piotrek1543 das Hauptproblem ist, dass ich nicht einen Weg zu laufen Espresso Test mehrmals (in Schleife) finden kann. Wie kann ich es tun? – Alexandr