Android Espresso Intents test randomly fail with ``init() must be called prior to using this method``

前端 未结 2 1899
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 18:03

I am working on pushing a project into espresso testing currently. I have read a bunch of documents and follow the given practises to get started.

Everything works f

2条回答
  •  滥情空心
    2020-12-28 18:30

    IntentsTestRule is derived from ActivityTestRule and should manage Intents.init() and Intents.release() for you.

    However, in my case the IntentsTestRule did not work properly. So I switch back to ActivityTestRule and call Intents.init() before and Intents.release() after the test which sent the Intent.

    For more information please see this reference.

提交回复
热议问题