How to work with a database on the mobile device?

Mobile Testing, Android App Testing.
User avatar
Aracknid
Posts: 365
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

How to work with a database on the mobile device?

Post by Aracknid » Wed May 22, 2019 2:47 pm

Hi,

Our mobile app has a database on the mobile device. I've downloaded "DB Browser (SQLite)", and I can manually copy the db from the device to my host machine and manually look at it.

I was wondering if it is possible to write user code in a code module to execute sql queries against the database on the device itself?

If so, can someone point me in the right direction.

If not, how do people typically access the data on the device during a test run?

Thanks,

Aracknid.

McTurtle
Posts: 263
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: How to work with a database on the mobile device?

Post by McTurtle » Thu May 23, 2019 9:48 am

Hi Aracknid,

I have never done this myself. But... If I had to, then I would try this approach described here that works via ADB.

Inspecting SQLite databases on Android and iOS

After testing if I can query values via ADB, then I would implement the same approach in C# by reading the ADB stream in the same way as getting the device address in the method GetFirstConnectedDeviceNames() in this forum post:

Adding a endpoint automatically

Were this hints useful? I am interested myself, if this works :)

Regards,
McTurtle