The road to Android automated testing--provider (ii)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.