robolectric/robolectric-gradle-plugin

Can not have more than 1 content provider testcase

rockerhieu opened this issue · 1 comments

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?

Moved to robolectric/robolectric#1082, I think this should be Robolectric issue, not the gradle plugin.