【发布时间】:2021-01-03 17:55:33
【问题描述】:
我的测试从未完成,我完全不知道为什么。我可以看到手机屏幕上显示的吐司。日志中绝对没有任何内容。
@RunWith(AndroidJUnit4::class)
@SmallTest
class BaseDataFragmentUITest
{
@Test
fun isDisplayingToastWhenFAILED_TO_UPDATE()
{
val fragmentScenario = launchFragmentInContainer<TestBaseDataFragmentImp>()
val toastString: String = context.resources.getString(com.developerkurt.gamedatabase.R.string.data_update_fail)
fragmentScenario.onFragment {
it.handleDataStateChange(BaseRepository.DataState.FAILED_TO_UPDATE)
onView(withText(toastString)).inRoot(withDecorView(not(it.requireActivity().getWindow().getDecorView()))).check(matches(isDisplayed()))
}
}
}
【问题讨论】:
标签: android unit-testing kotlin testing