Android Espresso onData跳过了

时间:2014-06-25 16:17:57

标签: android automated-tests android-espresso

我目前正在编写一个使用onData调用查找并按下按钮的测试。

public void testPickFavorites() throws InterruptedException {

        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(0)
                .onChildView(withId(yesButtonId))
                .perform(click());
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(1)
                .onChildView(withId(noButtonId))
                .perform(click());

        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(0)
                .onChildView(withId(maybeButtonId))
                .perform(click());
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(1)
                .onChildView(withId(maybeButtonId))
                .perform(click());
    }

这样做的问题是,虽然certin测试运行将成功执行所有4次点击,但还有其中一项或几项点击将无法执行。有谁知道是什么导致了这个问题?

0 个答案:

没有答案