????Test.java:

 

/**
* ?????????????
* ???????????SQLiteOpenHelper?????????????
* ??????????????????????????
* 1.sql????????SQLite?????
* 2.???????api??SQLite?????????
* 3.SQLite??????????
*/
import com.ghsy.createsqlitedb.db.MyOpenHelper;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.test.AndroidTestCase;
public class Test extends AndroidTestCase {
MyOpenHelper oh;
SQLiteDatabase db;
public void test() {
// ???????MyOpenHelper????
// ????????汾????????upgrade????--upgrade?????м?????????
MyOpenHelper oh = new MyOpenHelper(getContext()?? "people.db"?? null?? 3);
// ????????????????????????????????????????????????
SQLiteDatabase db = oh.getWritableDatabase();
db.close();
}
// ????????????
/**
* This method is called before a test is executed
*/
@Override
protected void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
oh = new MyOpenHelper(getContext()?? "people.db"?? null?? 3);
db = oh.getWritableDatabase();
}