java – Robotium:如何在继续之前等待加载完成?

我想为 Android应用程序编写Robotium / Junit测试.在某些步骤中,我希望我的测试等到旋转加载符号从屏幕上消失.

我怎样才能做到这一点?

解决方法

有不同的方法可以做到这一点.在Robotium中,您可以使用许多不同的waitFor方法.在您的情况下,您可以使用:
solo.waitForDialogToClose() //waits for the dialog to close
solo.waitForActivity() // if there is a activity change
solo.waitForText() //if a certain text appears after the loading is done
solo.waitForView() //if a certain view is shown after the load screen is done.

有关Robotium中的更多waitFor方法,请参阅Robotium API Documentation.

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...