Android Studio使用单元测试

package com.mytest.android.sqlite;


import android.database.sqlite.SQLiteDatabase;
import android.test.InstrumentationTestCase;

/**
 * Created by Administrator on 2015/12/8.
 */
public class TestClass extends InstrumentationTestCase{
    //测试执行前调用的方法
    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }
    //测试执行后调用的方法
    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void test() throws Exception{
        assertEquals(3, 2);
    }

    public void testCreateDb() throws Exception{
        MyOpenHelper oh = new MyOpenHelper(getInstrumentation().getContext(),"my.db",null,1);
        SQLiteDatabase db = oh.getReadableDatabase();
    }


}

相关推荐