You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if I add more test cases, only the 1st work, the rest will be failed. So I did a workaround by having only 1 fat test case which covers all the cases of CRUD for my ContentProvider. W00t, everything works fine.
Later on, I had to implement another ContentProvider, so I did the same: having another Test class whose 1 fat test case. This test case simply doesn't work, it always failed. After hours of debugging, I found out that the temporary database created by Robolectric will be closed and deleted after the first test case run.
Anyone else got the same issue while testing ContentProvider with Robolectric?
The text was updated successfully, but these errors were encountered:
Turned out it was because in the ContentProvider, I initialized SQLiteOpenHelper using singleton pattern. It causes Robolectric failed to recreate the database for each test.
Hey guys,
Thanks for the amazing work on this useful library.
Currently, I'm experiencing a bug with version 0.10.+. I can test CRUD for Content Provider using ShadowContentResolver (as an example here http://stackoverflow.com/questions/18022923/robolectric-contentprovider-testing).
But if I add more test cases, only the 1st work, the rest will be failed. So I did a workaround by having only 1 fat test case which covers all the cases of CRUD for my ContentProvider. W00t, everything works fine.
Later on, I had to implement another ContentProvider, so I did the same: having another Test class whose 1 fat test case. This test case simply doesn't work, it always failed. After hours of debugging, I found out that the temporary database created by Robolectric will be closed and deleted after the first test case run.
Anyone else got the same issue while testing ContentProvider with Robolectric?
The text was updated successfully, but these errors were encountered: