小编2BA*_*BAB的帖子

浓缩咖啡2-如何测试多项活动?

我已经看到了一些问题。

例如。Android Espresso测试应用程序流程

但是上面的答案在espresso 2中不起作用。这是我的摘录

@Rule
public ActivityTestRule<SplashActivity> mActivityTestRule = new ActivityTestRule<>(SplashActivity.class);


@Test
public void splashActivityTest() {
    onView(withId(R.id.splash_container)).perform(swipeLeft());
    onView(withId(R.id.splash_container)).perform(swipeLeft());

    // launch the main activity
    ViewInteraction appCompatButton = onView(
            allOf(withId(R.id.introduction_goto_btn), withText("goToMainActivity"), isDisplayed()));
    appCompatButton.perform(click());

    // the hierarchy can't find HomeBtn , it still hold the Splash's View, so the code below will fail
    onView(withId(R.id.home_btn)).check(ViewAssertions.matches(isDisplayed()));
}
Run Code Online (Sandbox Code Playgroud)

如果在一个TestFile中不允许进行多活动测试,那么如何进行测试多个活动的流程?

android-espresso

6
推荐指数
1
解决办法
2450
查看次数

标签 统计

android-espresso ×1