re-use workmanager instance between multiple unit tests

63 views
Skip to first unread message

Ck K

unread,
Jul 2, 2021, 10:20:34 AM7/2/21
to Robolectric


Hello,

Is there any way i can re-use an existing workmanager for application instances created by multiple tests?.

My issue:
i have multiple unit tests, my first test runs succesfully, next time onwards i face below error.

W/eSync: Can not re-initialize work manager, Robolectric problem?
2021-07-02T19:40:08.323+0530 [DEBUG] [TestEventLogger]     java.lang.IllegalStateException: WorkManager is already initialized.  Did you try to initialize it manually without disabling WorkManagerInitializer? See WorkManager#initialize(Context, Configuration) or the class level Javadoc for more information.
  so can i use re-use an existing workmanager (created during first unit test) for application instances created by multiple tests?

Thanks and Regards,
Chethan
Reply all
Reply to author
Forward
0 new messages