Zak*_*rdi 6 android android-espresso
我想简单地阻塞检测(测试)线程,直到 Espresso 空闲。
fun test(){
// do some stuff
Espresso.waitForIdle()
// do some more stuff once Espresso reports that the application is idle
}
Run Code Online (Sandbox Code Playgroud)
做到这一点的最佳方法是什么?
注:Espresso.waitForIdle()是我编的方法
您可以使用InstrumentationRegistry.getInstrumentation().waitForIdleSync().
https://developer.android.com/reference/android/app/Instrumentation.html#waitForIdleSync()
还有Espresso.onIdle(),但文档警告Only call this method for tests that do not interact with any UI elements, but require Espresso's main thread synchronisation!
https://developer.android.com/reference/android/support/test/espresso/Espresso.html#onIdle()
| 归档时间: |
|
| 查看次数: |
2984 次 |
| 最近记录: |