有時我遇到了我的應用程序中的罕見錯誤。但我不能重現它,因爲它非常罕見。所以,我決定寫簡單的咖啡測試:多次運行濃縮咖啡測試
@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))
}
}
}
如何匹配失敗時,我循環這個測試並停止了嗎?
嘗試'樂趣checkNotesListNotEmpty()拋出InterruptedException' – piotrek1543
@ piotrek1543的主要問題是,我無法找到一種方式來運行測試特濃多次(環路)。我該怎麼做? – Alexandr