最近我开始用集成测试覆盖我的项目,其中 mockito 提供演示者实例来验证我的视图是否在其事件期间正确调用演示者方法。
问题出在具有不可见ProgressBar
和RecyclerView
. 该屏幕的演示者一直在为此加载数据RecyclerView
并控制ProgressBar
. 当我用 mock(使用 Mockito)替换它时,它会导致相应的测试在一段时间后完全陷入错误:
Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000
cmp=com.example.kinopoisk/com.example.mvp.view.activity.MainActivity } within 45 seconds.
Perhaps the main thread has not gone idle within a reasonable amount of time?
There could be an animation or something constantly repainting the screen.
Or the activity is doing network calls on creation? See the threaddump logs.
For your reference the last time the event queue was idle before your activity launch request
was 1476191336691 and now the last time the queue went idle was: 1476191336691.
If these numbers are the same your activity might be hogging the event queue
但活动已成功运行,并且可供所有用户事件(如点击等)访问。
你怎么看,是什么导致了问题?
这只是社区知识库的问题,我自己找到了答案。