Android测试框架2(非原创)
package com.example.sqlitedatabase.test;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.test.AndroidTestCase;
import com.example.showdata.MyOpenHelper;
public class JunitTest3 extends AndroidTestCase {
private MyOpenHelper helper;
private SQLiteDatabase db;
@Override
protected void setUp() throws Exception {//该方法会在JunitTest3 对象创建完毕后测试方法执行前执行
// TODO Auto-generated method stub
super.setUp();
helper = new MyOpenHelper(getContext(), "Emp.db", null, 1);
db = helper.getWritableDatabase();
}
@Override
protected void tearDown() throws Exception {//该方法会在JunitTest3 的该测试方法执行完毕时调用
// TODO Auto-generated method stub
super.tearDown();
db.close();
}
}