Again, the second test method:
Prerequisites: Requires your test engineering to run in a unified process with the project being tested, using instrumentationtestcase related subclasses.
1. Obtain the DB list of the application being tested, by calling ApplicationContext's databaselist;
2, custom a sqliteopenhelper such as the operation interface, such as: public class Databaseutil extends Sqliteopenhelper
3, according to the first step to get the DB list array, get the db to be measured, call the construction method of Databaseutil, to get the read and write interface of the DB;
4, get dbname below need to know the specific table name, through the following SQL execution:
Cursor null); while (C.movetonext ()) { LOG.W ("test_db", c.getstring (0)); }
5, now dbname and TableName have already known, want to do what to do
Like what:
Db.query ();
Db.insert ();
Db.update ();
Db.delete ();
The road to Android automated testing--provider (ii)