Android 如何在浓缩咖啡测试中循环3个按钮
你能帮我吗?我正在写一份浓缩咖啡测试。代码如下:Android 如何在浓缩咖啡测试中循环3个按钮,android,android-espresso,Android,Android Espresso,你能帮我吗?我正在写一份浓缩咖啡测试。代码如下: onView(ViewMatchers.withId(R.id.btnControl1)).perform(click()); SystemClock.sleep(delay); onView(ViewMatchers.withId(R.id.btnControl2)).perform(click()); SystemClock.sleep(delay); onView(ViewMatchers.withId(R.id.btnContr
onView(ViewMatchers.withId(R.id.btnControl1)).perform(click());
SystemClock.sleep(delay);
onView(ViewMatchers.withId(R.id.btnControl2)).perform(click());
SystemClock.sleep(delay);
onView(ViewMatchers.withId(R.id.btnControl3)).perform(click());
SystemClock.sleep(delay);
我想循环一下。例如:单击这3个按钮20次
提前谢谢 您可以将其放入for循环中:
for (int i = 0; i < 20; i++) {
onView(ViewMatchers.withId(R.id.btnControl1)).perform(click());
SystemClock.sleep(delay);
onView(ViewMatchers.withId(R.id.btnControl2)).perform(click());
SystemClock.sleep(delay);
onView(ViewMatchers.withId(R.id.btnControl3)).perform(click());
SystemClock.sleep(delay);
}
for(int i=0;i<20;i++){
onView(ViewMatchers.withId(R.id.btnControl1)).perform(click());
系统时钟。睡眠(延迟);
onView(ViewMatchers.withId(R.id.btnControl2)).perform(click());
系统时钟。睡眠(延迟);
onView(ViewMatchers.withId(R.id.btnControl3)).perform(click());
系统时钟。睡眠(延迟);
}