Sunday, April 17, 2011

[android-developers] Testing ContentProvider with sample data

Hello,
I want to test ContentProvider that serves data from sqlite database.
How can I initialize ContentProvider using ProviderTestCase2 that it
would read data from certain database file?
My first idea was to add test.db to project assets and in
ProviderTestCase2.setUp()
copy it to location where ContentProvider expectes to find db file.
Unfortunately creating ContentProvider with IsolatedContext or
MockContext modifies
database location so it changes to test.oldname.db and I observed that
it recreates it
before each test (clears all data).

Best regards,
Witek

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate