[android-developers] Re: Isolated database tests

2012-09-29 Thread Karl-Johan Jensen
Sorry for resurrecting the thread but I was unable to find answer other place than the docs. You can indeed make isolated database tasts by keeping a reference to your IsolatedContext and calling deleteDatabase(name). private DatabaseManager manager = null; > private IsolatedContext isolate;

[android-developers] Re: Isolated database tests

2011-01-19 Thread A. Elk
Try RenamingDelegatingContext. It uses a normal Context for most stuff, but allows you to prefix file and database names to avoid munging your production stuff. Elk! On Jan 19, 7:16 am, Mattias Svala wrote: > Hello! > > I would like to be able to write tests for my database code and have them >

[android-developers] Re: Isolated database tests

2011-01-19 Thread Hari Edo
The database is just one file in your app's data directory. You need to specify the name of the database when you use it, and that becomes the filename that defines the database file. Just make a backup copy of the original file, or make a brand new database file for your tests. You should be a