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 able to open and use two databases
independently even at the same time, though I haven't tried
instantiating
more than one SQLiteDatabase object at a time.


On Jan 19, 10:16 am, Mattias Svala <thebra...@gmail.com> wrote:
> Hello!
>
> I would like to be able to write tests for my database code and have them
> run without touching the database that my actual application uses. It would
> be OK for the database tests to start with an empty or non existing database
> each time the tests are run.
>
> Is this possible?
>
> I would have guessed that I could use IsolatedContext in some way to achieve
> this, but I have not been able to figure out how. Perhaps there is some
> other way to have my database tests run isolated from the application's
> database?
>
> :.:: mattias

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to