Android Studio 3.2
我要测试按返回按钮。 因此,这里是我的意式浓缩咖啡的测试:
base
但是测试失败:
@RunWith(AndroidJUnit4::class)
class AddTraderActivityTest {
@get:Rule
var addTraderActivity: IntentsTestRule<AddTraderActivity> = IntentsTestRule(AddTraderActivity::class.java)
@Test
fun backButton_press() {
try {
pressBack()
fail("Should have thrown NoActivityResumedException")
} catch (expected: NoActivityResumedException)
{}
}