WEB开发网
开发学院手机开发Android 开发 android SQLite数据库的增删改查以及事务的单元测... 阅读

android SQLite数据库的增删改查以及事务的单元测试

 2010-11-05 00:56:30 来源:WEB开发网   
核心提示:}public void testSave() throws Throwable{PersonService personservice = new PersonService(this.getContext());Person person = new Person("张大千",29);perso

}

public void testSave() throws Throwable{

PersonService personservice = new PersonService(this.getContext());

Person person = new Person("张大千",29);

personservice.save2(person);

}

public void tesetUpdate() throws Throwable{

PersonService personService = new PersonService(this.getContext());

Person person = personService.find(1);

person.setName("jim");

personService.update(person);

}

public void testCount() throws Throwable{

PersonService personService = new PersonService(this.getContext());

Log.i("aa",personService.getCount()+"");

}

public void testGetScrollData() throws Throwable{

PersonService personService = new PersonService(this.getContext());

List< Person> persons = personService.getScrollData(0,3);

for(Person person:persons){

Log.i("aa",person.toString());

}

}

public void TrancesTest() throws Throwable{

PersonService personService = new PersonService(this.getContext());

Person person = new Person("aaaaaaa",28);

personService.savesTrannces(person);

}

}

AndroidManifest.xml配置文件中添加单元测试的权限:

< ?xml version="1.0" encoding="utf-8"?>

< manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.gohighsoft.db" android:versionCode="1"

android:versionName="1.0">

< application android:icon="@drawable/icon" android:label="@string/app_name">

< uses-library android:name="android.test.runner" />

< activity android:name=".MainActivity" android:label="@string/app_name">

< intent-filter>

< action android:name="android.intent.action.MAIN" />

上一页  1 2 3 4 5 6  下一页

Tags:android SQLite 数据库

编辑录入:coldstar [复制链接] [打 印]
赞助商链接